Are PHP arrays always dynamically resizable?
PHP arrays are dynamically resizable by default, meaning they can grow or shrink in size as elements are added or removed. If you want to create a fixed-size array in PHP, you can use the `SplFixedArray` class, which allows you to set a specific size for the array upon initialization.
// Create a fixed-size array with 5 elements
$array = new SplFixedArray(5);
// Set values for the array
$array[0] = 'Apple';
$array[1] = 'Banana';
$array[2] = 'Orange';
$array[3] = 'Grape';
$array[4] = 'Pineapple';
// Access and print values from the fixed-size array
for ($i = 0; $i < $array->getSize(); $i++) {
echo $array[$i] . "\n";
}