3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function by_return($dummy=null) { $dummy = str_repeat("1",100 * 1024 * 1024); return $dummy; } function by_reference(&$dummy) { $dummy = null; $dummy = str_repeat("1",100 * 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
348176/384768 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857632 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.14
348136/384768 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857632 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.6.0 - 5.6.28
220720/227104 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.5.0 - 5.5.37
220720/227048 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.4.10 - 5.4.45
221240/227032 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.4.0 - 5.4.9
221240/226984 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.3.11 - 5.3.29
625280/636736 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.10
624976/636432 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.2.10 - 5.2.17
83224/93768 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.2.7 - 5.2.9
83880/93800 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.2.3 - 5.2.6
84200/94120 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.2.2
82128/91792 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.2.1
82080/91744 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 104857601 bytes) in /in/Y6kiG on line 4
Process exited with code 255.
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/Y6kiG 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/Y6kiG 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/Y6kiG 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/Y6kiG on line 12