3v4l.org

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