3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function by_return($dummy=null) { $dummy = str_repeat("1",10 * 1024 * 1024); return $dummy; } function by_reference(&$dummy) { $dummy = null; $dummy = str_repeat("1",10 * 1024 * 1024); } echo memory_get_usage()."/".memory_get_peak_usage()."\n"; //1 always returns: 105493696/105496656 //$nagid = by_return(); echo memory_get_usage()."/".memory_get_peak_usage()."\n"; unset($nagid); //2 always returns: 105493696/210354184 even if we comment 1st part by_reference($dummy); echo memory_get_usage()."/".memory_get_peak_usage()."\n"; unset($dummy);
Output for 7.1.0
347880/384696 347912/384696 10837816/10837896
Output for 7.0.0 - 7.0.14
347840/384696 347872/384696 10837776/10837856
Output for hhvm-3.10.0 - 3.12.0
2097152/2097152 2097152/2097152 2097152/2097152
Output for 5.6.0 - 5.6.28
220576/227104 220624/227104 10706576/21193984
Output for 5.5.0 - 5.5.36
220576/227048 220608/227048 10706560/21193856
Output for 5.4.10 - 5.4.45
221096/227032 221128/227032 10707080/21193816
Output for 5.4.0 - 5.4.9
221096/226984 221128/226984 10707080/21193792
Output for 5.3.11 - 5.3.29
625008/636736 625040/636736 11110968/21598016
Output for 5.3.0 - 5.3.10
624704/636432 624736/636432 11110664/21597712
Output for 5.2.10 - 5.2.17
82952/93768 82984/93768 10569072/21055592
Output for 5.2.7 - 5.2.9
83608/93800 83712/93800 10569840/21055624
Output for 5.2.3 - 5.2.6
83928/94120 84032/94120 10570160/21055944
Output for 5.2.2
81856/91792 81888/91792 10568056/21053840
Output for 5.2.1
81808/91744 81880/91744 10568104/21053888
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/ORsKi on line 12
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/ORsKi on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/ORsKi on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/ORsKi on line 12