You can't predefine a size of an array in php. A good way to acheive your goal is the following:
// Create a new array.
$array = array();
// Add an item while $i < yourWantedItemQuantity
for ($i = 0; $i < $number_of_items; $i++)
{
array_push($array, $some_data);
//or $array[] = $some_data; for single items.
}
Note that it is way faster to use array_fill() to fill an Array :
$array = array_fill(0,$number_of_items, $some_data);
If you want to verify if a value has been set at an index, you should use the following: array_key_exists("key", $array) or isset($array["key"])
See array_key_exists , isset and array_fill