php8.5
Home/ Manual/ yaf / yaf_config_abstract/ Yaf_Config_Abstract::toArray

Yaf_Config_Abstract::toArray

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Export configuration as array

Description

Yaf_Config_Abstract::toArray(): array

Returns the entire configuration as a plain PHP array.

Parameters Parameters

Return Values

The configuration data as an array, or null if no configuration data is loaded.

Examples

Yaf_Config_Abstract::toArray example

php
<?php
$config = new Yaf_Config_Simple([
    'application' => ['name' => 'MyApp'],
    'database'    => ['host' => 'localhost'],
]);

print_r($config->toArray());
?>

The above example will output something similar to:

output
Array
(
    [application] => Array
        (
            [name] => MyApp
        )

    [database] => Array
        (
            [host] => localhost
        )

)

See Also

  • Yaf_Config_Abstract::get
  • Yaf_Config_Ini::toArray
  • Yaf_Config_Simple::toArray

Source: reference/yaf/yaf_config_abstract/toarray.xml · from the official PHP manual (php/doc-en)