php8.5
Home/ Manual/ yaf / yaf_config_simple/ Yaf_Config_Simple::toArray

Yaf_Config_Simple::toArray

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Export configuration as array

Description

Yaf_Config_Simple::toArray(): array

Returns the entire configuration as a plain PHP array.

Parameters Parameters

Return Values

The configuration data as an array.

Examples

Yaf_Config_Simple::toArray example

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

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

The above example will output something similar to:

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

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

)

See Also

  • Yaf_Config_Simple::get

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