3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(){ $ret = []; for($i=0;$i<100000;$i++){ $ret[]= new stdClass(); } 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"; }
Output for 7.4.0
test? 388288 9627152 1428672 1428672 1428672 1428672 1428672 1428672 1428672 1428672 1428672 1428672
Output for 7.3.0 - 7.3.12
test? 388248 9627112 1428632 1428632 1428632 1428632 1428632 1428632 1428632 1428632 1428632 1428632
Output for 7.2.0 - 7.2.25
test? 384488 9623352 1424872 1424872 1424872 1424872 1424872 1424872 1424872 1424872 1424872 1424872
Output for 7.1.25 - 7.1.33
test? 347848 9586712 1388232 1388232 1388232 1388232 1388232 1388232 1388232 1388232 1388232 1388232
Output for 7.1.0 - 7.1.1, 7.1.7 - 7.1.21
test? 347920 9586784 1388304 1388304 1388304 1388304 1388304 1388304 1388304 1388304 1388304 1388304
Output for 7.1.2 - 7.1.6
test? 348216 9587080 1388600 1388600 1388600 1388600 1388600 1388600 1388600 1388600 1388600 1388600

preferences:
79.61 ms | 401 KiB | 73 Q