This results in large undefined indexes because you are not adding anything to $array_variable.
Change the code:
$array_variable = array();
for($i=1; $i<=20000; $i++){
if($i%2 == 1){
$array_variable[] = $i;
}
}
var_dump($array_variable);
For better readability of the array, you can use:
echo "<pre>";
print_r($array_variable);
echo "</pre>";
source
share