3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo "before allocation: ".memory_get_usage(true).PHP_EOL; $object = str_repeat("\0", 1000000); echo "after allocation: ".memory_get_usage(true).PHP_EOL; $object2 = $object; echo "after assignment: ".memory_get_usage(true).PHP_EOL; $object3 =& $object; echo "after reference assignment: ".memory_get_usage(true).PHP_EOL;
Output for 7.0.0 - 7.1.0
before allocation: 2097152 after allocation: 2097152 after assignment: 2097152 after reference assignment: 2097152
Output for hhvm-3.12.0
before allocation: 302648 after allocation: 1351224 after assignment: 1351224 after reference assignment: 1351240
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.1 - 5.2.17, 5.4.0 - 5.6.21
before allocation: 262144 after allocation: 1310720 after assignment: 1310720 after reference assignment: 2359296
Output for 5.3.0 - 5.3.29
before allocation: 786432 after allocation: 1835008 after assignment: 1835008 after reference assignment: 2883584
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/mFXAM 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/mFXAM 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/mFXAM 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/mFXAM on line 3