SplFixedArray::fromArray
Import a PHP array in a SplFixedArray instance
&reftitle.description;
public static SplFixedArraySplFixedArray::fromArray
arrayarray
booleansave_indexestrue
Import the PHP array array
in a new SplFixedArray instance
&reftitle.parameters;
array
The array to import.
save_indexes
Try to save the numeric indexes used in the original array.
&reftitle.returnvalues;
Returns an instance of SplFixedArray
containing the array content.
&reftitle.examples;
SplFixedArray::fromArray example
1, 0 => 2, 3 => 3));
var_dump($fa);
$fa = SplFixedArray::fromArray(array(1 => 1, 0 => 2, 3 => 3), false);
var_dump($fa);
?>
]]>
&example.outputs;
int(2)
[1]=>
int(1)
[2]=>
NULL
[3]=>
int(3)
}
object(SplFixedArray)#2 (3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
]]>