array Config_Container::toArray (
void
)
このメソッドは、Config ツリーを配列形式で返します。その書式は
<?php
$section[directive][index] = value
?>
となります。コンテナが属性を保持している場合は、属性のキーに
'@'
、属性の値に
'#'
を使用します。
インデックスがここにある理由は、
同名のディレクティブやセクションが複数存在する可能性があるためです。
toArray() メソッドは、そのような場合も想定しています。
Config_Container ツリーを配列形式で返します。
This function can not be called statically.
toArray()() の使用例
<?php
$attributes = array('id' => 'db', 'language' => 'en');
$section =& new Config_Container('section', 'main', null, $attributes);
$section->createDirective('authentication', 'one', array('type' => 'mysql'));
$section->createDirective('authentication', 'two', array('type' => 'oracle'));
$section->createDirective('permission', 'group');
var_dump($section->toArray());
?>
同名の属性やディレクティブが含まれる結果の配列