3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = 11; $bar = 12; //optimal: memory used once $foo = $foo ^ $bar; $bar = $foo ^ $bar; $foo = $foo ^ $bar; var_dump($foo, $bar); echo memory_get_peak_usage(); $foo = 11; $bar = 12; //readable: $baz = $foo; $foo = $bar; $bar = $baz; // var_dump($foo, $bar); echo memory_get_peak_usage();
Output for 7.0.0 - 7.1.0
int(12) int(11) 381448int(12) int(11) 381448
Output for hhvm-3.10.0 - 3.12.0
int(12) int(11) 2097152int(12) int(11) 2097152
Output for 5.5.24 - 5.6.28
int(12) int(11) 220672int(12) int(11) 220672
Output for 5.4.10 - 5.4.45
int(12) int(11) 220608int(12) int(11) 220608
Output for 5.4.0 - 5.4.9
int(12) int(11) 220080int(12) int(11) 220080
Output for 5.3.11 - 5.3.29
int(12) int(11) 626976int(12) int(11) 626976
Output for 5.3.0 - 5.3.10
int(12) int(11) 626672int(12) int(11) 626672
Output for 5.2.10 - 5.2.17
int(12) int(11) 83832int(12) int(11) 83832
Output for 5.2.7 - 5.2.9
int(12) int(11) 83864int(12) int(11) 83864
Output for 5.2.3 - 5.2.6
int(12) int(11) 84184int(12) int(11) 84184
Output for 5.2.1 - 5.2.2
int(12) int(11) 81976int(12) int(11) 81976
Output for 5.0.0 - 5.2.0
int(12) int(11) Fatal error: Call to undefined function memory_get_peak_usage() in /in/lSelg on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
int(12) int(11) Fatal error: Call to undefined function: memory_get_peak_usage() in /in/lSelg on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.4
int(12) int(11) Fatal error: Call to undefined function: memory_get_peak_usage() in /in/lSelg on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
int(12) int(11) Fatal error: Call to undefined function: memory_get_peak_usage() in /in/lSelg on line 10