3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "Init: ".memory_get_usage() . PHP_EOL . PHP_EOL; $test = $test2 = array(); $i = 0; while ($i++ < 100000) { $test[] = $i; $test2[] = $i; } // test loop 1 echo "Test 1: ".memory_get_usage() . PHP_EOL; foreach ($test as $k => $v) { unset($test[$k]); echo memory_get_usage() . PHP_EOL . PHP_EOL; break; } // test loop 2 echo "Test 2: ".memory_get_usage() . PHP_EOL; foreach ($test2 as $k => &$v) { unset($test2[$k]); echo memory_get_usage() . PHP_EOL . PHP_EOL; break; }

preferences:
32.28 ms | 402 KiB | 5 Q