3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = []; for( $i =0 ; $i < 50000 ; $i++) { $data[] = md5('test'); } echo number_format(memory_get_usage(), 0, ',', '.')."\n"; echo number_format(memory_get_usage(true), 0, ',', '.')."\n"; unset($data); echo number_format(memory_get_usage(), 0, ',', '.')."\n"; echo number_format(memory_get_usage(true), 0, ',', '.')."\n"; $dataForObject = []; for( $i =0 ; $i < 50000 ; $i++) { $dataForObject[] = md5('test'); } echo number_format(memory_get_usage(), 0, ',', '.')."\n"; echo number_format(memory_get_usage(true), 0, ',', '.')."\n"; unset($dataForObject); echo number_format(memory_get_usage(), 0, ',', '.')."\n"; echo number_format(memory_get_usage(true), 0, ',', '.');
based on IuNSq
Output for 7.1.0
5.652.856 6.295.552 351.560 4.194.304 5.652.888 6.295.552 351.560 4.194.304
Output for 7.0.0 - 7.0.14
5.652.888 6.295.552 351.592 4.194.304 5.652.920 6.295.552 351.592 4.194.304
Output for 5.6.8 - 5.6.28
10.347.816 10.747.904 223.240 786.432 10.347.856 10.747.904 223.240 1.048.576
Output for 5.5.24 - 5.5.35
10.347.816 10.747.904 223.224 786.432 10.347.824 10.747.904 223.224 1.048.576
Output for 5.4.10 - 5.4.45
10.348.336 10.747.904 223.744 786.432 10.348.368 10.747.904 223.744 1.048.576
Output for 5.4.0 - 5.4.9
10.347.816 10.747.904 223.216 786.432 10.347.808 10.747.904 223.216 1.048.576
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/bL0ot on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/bL0ot on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bL0ot on line 2
Process exited with code 255.