3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $mem = memory_get_usage(false); echo $mem . '<br/>'; $one = array(); $two = array(); $three = array(); $i = 0; $j = 0; $k = 0; $mem2 = memory_get_usage(false); echo $mem2 . ' (+' . ($mem2 - $mem) . ')<br/>'; $mem = $mem2; for($j = 0; $j < 100; $j++) { $two[] = (object) NULL; } $mem2 = memory_get_usage(false); echo $mem2 . ' (+' . ($mem2 - $mem) . ')<br/>'; $mem = $mem2; for($i = 0; $i < 100; $i++) { $one[] = new stdClass(); } $mem2 = memory_get_usage(false); echo $mem2 . ' (+' . ($mem2 - $mem) . ')<br/>'; $mem = $mem2; for($k = 0; $k < 100; $k++) { $three[] = new stdClass; } $mem2 = memory_get_usage(false); echo $mem2 . ' (+' . ($mem2 - $mem) . ')<br/>'; $mem = $mem2;
Output for 7.1.0
350280<br/>350312 (+32)<br/>362560 (+12248)<br/>374808 (+12248)<br/>387056 (+12248)<br/>
Output for 7.0.0 - 7.0.14
350280<br/>350480 (+200)<br/>362672 (+12192)<br/>374864 (+12192)<br/>387056 (+12192)<br/>
Output for hhvm-3.10.0 - 3.12.0
2097152<br/>2097152 (+0)<br/>2097152 (+0)<br/>2097152 (+0)<br/>2097152 (+0)<br/>
Output for 5.6.0 - 5.6.28
221584<br/>222864 (+1280)<br/>242432 (+19568)<br/>261888 (+19456)<br/>281328 (+19440)<br/>
Output for 5.5.0 - 5.5.35
221584<br/>222856 (+1272)<br/>242416 (+19560)<br/>261880 (+19464)<br/>281320 (+19440)<br/>
Output for 5.4.10 - 5.4.45
222104<br/>223376 (+1272)<br/>242936 (+19560)<br/>262392 (+19456)<br/>281832 (+19440)<br/>
Output for 5.4.0 - 5.4.9
221576<br/>222848 (+1272)<br/>242408 (+19560)<br/>261848 (+19440)<br/>281288 (+19440)<br/>
Output for 5.3.11 - 5.3.29
629112<br/>630656 (+1544)<br/>666280 (+35624)<br/>701640 (+35360)<br/>737000 (+35360)<br/>
Output for 5.3.0 - 5.3.10
628808<br/>630352 (+1544)<br/>665976 (+35624)<br/>701336 (+35360)<br/>736696 (+35360)<br/>
Output for 5.2.10 - 5.2.17
86744<br/>88232 (+1488)<br/>123056 (+34824)<br/>157616 (+34560)<br/>192176 (+34560)<br/>
Output for 5.2.7 - 5.2.9
87352<br/>88840 (+1488)<br/>124704 (+35864)<br/>159264 (+34560)<br/>193824 (+34560)<br/>
Output for 5.2.3 - 5.2.6
87672<br/>89160 (+1488)<br/>125024 (+35864)<br/>159584 (+34560)<br/>194144 (+34560)<br/>
Output for 5.2.2
85568<br/>87024 (+1456)<br/>122936 (+35912)<br/>157496 (+34560)<br/>192056 (+34560)<br/>
Output for 5.2.1
85568<br/>87024 (+1456)<br/>122320 (+35296)<br/>156904 (+34584)<br/>191488 (+34584)<br/>
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/1SBKi on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/1SBKi on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/1SBKi on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/1SBKi on line 3