Creating a multidimensional array using SplFixedArray

We might also require creating two or more dimensional arrays using SplFixedArray. In order to do that, it is recommended to follow this example:

$array = new SplFixedArray(100);
for ($i = 0; $i < 100; $i++)
$array[$i] = new SplFixedArray(100);

We are actually creating another SplFixedArray inside each array indexes. We can add as many dimensions as we want. But we have to remember that, with dimensions, we are multiplying the size of the array. So it can grow really big very quickly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset