3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php fscanf(STDIN, "%d", $n); $c = 0; $array = []; for($i=1;$i<=1000000000;$i++) { $c += substr_count($i, 1); $array[$i] = $c; } var_dump($array); echo $c . "\n";
based on jCFbX
Output for 7.0.0 - 7.2.0
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 67108872 bytes) in /in/idD0R on line 7
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/idD0R on line 6
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/idD0R on line 4
Process exited with code 255.