May 2017
Intermediate to advanced
340 pages
8h 16m
English
We might also need to convert a SplFixedArray to a regular PHP array to apply some predefined array functions from PHP. Like the previous example, this is also a very simple thing to do:
$items = 5; $array = new SplFixedArray($items); for ($i = 0; $i < $items; $i++) { $array[$i] = $i * 10; } $newArray = $array->toArray(); print_r($newArray);
This will produce the following output:
Array ( [0] => 0 [1] => 10 [2] => 20 [3] => 30 [4] => 40 )
Read now
Unlock full access