php8.5
Home/ Manual/ yaconf / yaconf/ Yaconf::__debug_info

Yaconf::__debug_info

PHP function Edit on GitHub ✎

(PECL yaconf >= 1.1.0)

Inspect how a configuration value is stored

Description

Yaconf::__debug_info(string $name): array|null

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.

Warning

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.

Parameters

name

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

Return Values

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.
  • changed — false 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.

Examples

Yaconf::__debug_info example

php
<?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
?>

See Also

  • Yaconf::get
  • Yaconf::has

Source: reference/yaconf/yaconf/debuginfo.xml · from the official PHP manual (php/doc-en)