3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for ($i = 0; $i < 10000; $i += 1) { $a[] = new ArrayObject(array("a" => "b")); } var_dump((memory_get_peak_usage(true) / 1024 / 1024) . "MB");
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 8.3.0 - 8.3.6
string(3) "8MB"
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
string(3) "6MB"
Output for 5.2.1 - 5.2.5, 5.5.37 - 5.5.38, 5.6.23 - 5.6.38
string(3) "9MB"
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.36, 5.6.0 - 5.6.22
string(6) "8.25MB"
Output for 5.3.0 - 5.3.29
string(7) "10.75MB"
Output for 5.2.6 - 5.2.17
string(6) "9.25MB"
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_peak_usage() in /in/pXWE0 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/pXWE0 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/pXWE0 on line 5

preferences:
240.46 ms | 401 KiB | 424 Q