3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NonLeakingClass { } function test(){ $ret = []; for($i=0;$i<100000;$i++){ $ret[]= new NonLeakingClass(); } return $ret; } $i=0; echo "test?".PHP_EOL; echo memory_get_usage()."\n"; while($i++<10){ if($i==1){ $a=test(); echo memory_get_usage()."\n"; unset($a); } echo memory_get_usage()."\n"; }

preferences:
33.75 ms | 402 KiB | 5 Q