What are the advantages of using SplFixedArray instead of an array?
What are the advantages of setting a value for an array (in PHP)?
Example with array
:
$arr = array();
$arr[0] = 'Stack';
$arr[1] = 'Overflow';
$arr[2] = 'blablabla';
Example with SplFixedArray
$arr = new SplFixedArray(2);
$arr[0] = 'Stack';
$arr[1] = 'Overflow';
$arr[2] = 'blablabla'; // RunTimeException: Index invalid or out of range