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"; class x { public $value; public function __construct($value) { $this->value = $value; } } $dataForObject = []; for( $i =0 ; $i < 50000 ; $i++) { $dataForObject[] = md5('test'); } $x = new x($dataForObject); echo number_format(memory_get_usage(), 0, ',', '.')."\n"; echo number_format(memory_get_usage(true), 0, ',', '.')."\n"; unset($dataForObject); unset($x); echo number_format(memory_get_usage(), 0, ',', '.')."\n"; echo number_format(memory_get_usage(true), 0, ',', '.');
based on bL0ot
Output for 7.1.0
5.653.880 6.295.552 352.584 4.194.304 5.653.968 6.295.552 352.584 4.194.304
Output for 7.0.0 - 7.0.14
5.653.944 6.295.552 352.648 4.194.304 5.654.032 6.295.552 352.648 4.194.304
Output for 5.6.7 - 5.6.28
10.351.688 10.747.904 227.120 786.432 10.351.976 10.747.904 227.152 1.048.576
Output for 5.5.24 - 5.5.35
10.351.680 10.747.904 227.096 786.432 10.351.928 10.747.904 227.128 1.048.576
Output for 5.4.10 - 5.4.45
10.352.192 10.747.904 227.608 786.432 10.352.464 10.747.904 227.640 1.048.576
Output for 5.4.0 - 5.4.9
10.352.176 10.747.904 227.608 786.432 10.352.424 10.747.904 227.640 1.048.576
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/pV16e 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/pV16e on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/pV16e on line 2
Process exited with code 255.