3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getMem() { return memory_get_usage(true) / 1024; } $array = range(1, 1000); 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;

preferences:
27.25 ms | 402 KiB | 5 Q