array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'ds-map.toarray.php', 1 => 'Ds\\Map::toArray', ), 'up' => array ( 0 => 'class.ds-map.php', 1 => 'Ds\\Map', ), 'prev' => array ( 0 => 'ds-map.sum.php', 1 => 'Ds\\Map::sum', ), 'next' => array ( 0 => 'ds-map.union.php', 1 => 'Ds\\Map::union', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/map/toarray.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
Converts the map to an array.
Maps where non-scalar keys are can't be converted to an array.
An array will treat all numeric keys as integers,
eg. "1"
and 1
as keys in the map
will only result in 1
being included in the array.
注意:
Casting to an array is not supported yet.
この関数にはパラメータはありません。
An array containing all the values in the same order as the map.
例1 Ds\Map::toArray() example
<?php
$map = new \Ds\Map([
"a" => 1,
"b" => 2,
"c" => 3,
]);
var_dump($map->toArray());
?>
上の例の出力は、 たとえば以下のようになります。
array(3) { ["a"]=> int(1) ["b"]=> int(2) ["c"]=> int(3) }