SplFixedArray::fromArray
Importe un tableau PHP dans un tableau à taille fixe
&reftitle.description;
public static SplFixedArraySplFixedArray::fromArray
arrayarray
boolpreserveKeys&true;
Importe le &array; PHP array
dans un tableau à taille fixe.
&reftitle.parameters;
array
Le tableau à importer.
preserveKeys
Tente de préserver les index numérique du tableau original.
&reftitle.returnvalues;
Retourne un objet SplFixedArray avec le même
contenu que le tableau passé en argument.
&reftitle.examples;
Exemple avec SplFixedArray::fromArray
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)
}
]]>