3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getMem() { return memory_get_usage(true) / 1024; } $array = range(1, 1000000); shuffle($array); $mem = getMem(); $string = compress($array); echo 'You used : ', getMem() - $mem, ' Kb', PHP_EOL; function compress($array) { return gzdeflate(base64_encode(implode(',', $array)), 9); } function uncompress($data) { return explode(',', base64_decode(gzinflate($data))); } file_put_contents('demo', $string); $uncompress = uncompress($string); for ($i = 0; $i < 100; $i++) { $test = rand(0, 1000000 - 1); if ($array[$test] != $uncompress[$test]) { die('You failed!!!'); } } echo 'You Win', PHP_EOL; echo date('Y-m-d H:i:s'), PHP_EOL;
Output for 7.0.0 - 7.0.5, 7.0.8 - 7.1.0
You used : 3872 Kb Warning: file_put_contents(demo): failed to open stream: Permission denied in /in/hUkrO on line 23 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 16777224 bytes) in /in/hUkrO on line 20
Process exited with code 255.
Output for 7.0.6 - 7.0.7
You used : 3872 Kb Warning: file_put_contents(demo): failed to open stream: Permission denied in /in/hUkrO on line 23
Process exited with code 137.
Output for hhvm-3.10.0 - 3.12.0
You used : 10362.828125 Kb Warning: Permission denied in /in/hUkrO on line 23 You Win 2013-07-22 20:46:37
Output for 5.3.0 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/hUkrO on line 8
Process exited with code 255.
Output for 5.2.6 - 5.2.17
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/hUkrO on line 8
Process exited with code 255.
Output for 5.2.1 - 5.2.5
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/hUkrO on line 8
Process exited with code 255.
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/hUkrO on line 5
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/hUkrO on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/hUkrO on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/hUkrO on line 5