Last Call for the State of PHP Survey

Yaconf::__debug_info

(PECL yaconf >= 1.1.0)

Yaconf::__debug_infoInspect how a configuration value is stored

Описание

public static function Yaconf::__debug_info(string $name): ?array

Returns debugging information about the value stored under name: the memory address of the stored value and whether the value still lives inside Yaconf's compacted storage block.

Внимание

This method exists solely for Yaconf's own test suite, which uses it to verify that the extension is working correctly. Do not use it in production code, and do not rely on the format of its output: the returned array may change at any time.

Список параметров

name

The configuration name to inspect, using the same dot notation as Yaconf::get().

Возвращаемые значения

An array with four entries when the configuration exists, null otherwise:

  • key — the name that was looked up.

  • address — the memory address of the stored value. Values are stored as interned strings or immutable arrays, so this address stays constant until the configuration is reloaded.

  • val — the stored value itself.

  • changedfalse while the value's data still lives inside the compacted storage block, meaning the operating system has not had to copy the page (copy-on-write still applies); true when the value has been re-allocated outside the block.

Примеры

Пример #1 Yaconf::__debug_info() example

<?php
// assuming app.ini contains name="shop"
var_dump(Yaconf::__debug_info("app.name"));
/*
array(4) {
  ["key"]=>
  string(8) "app.name"
  ["address"]=>
  string(14) "0x7f8b1c0a3d20"
  ["val"]=>
  string(4) "shop"
  ["changed"]=>
  bool(false)
}
*/

var_dump(Yaconf::__debug_info("app.missing")); // NULL
?>

Смотрите также

Добавить

Примечания пользователей

Пользователи ещё не добавляли примечания для страницы
To Top