3v4l.org

run code in 200+ 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.3.0
int(12) int(11) 422528int(12) int(11) 422528
Output for 7.2.0 - 7.2.13
int(12) int(11) 418112int(12) int(11) 418112
Output for 7.0.0 - 7.1.25
int(12) int(11) 381376int(12) int(11) 381376
Output for 5.5.0 - 5.6.38
int(12) int(11) 220488int(12) int(11) 220488
Output for 5.4.10 - 5.4.45
int(12) int(11) 220424int(12) int(11) 220424
Output for 5.4.0 - 5.4.9
int(12) int(11) 219896int(12) int(11) 219896
Output for 5.3.11 - 5.3.29
int(12) int(11) 626432int(12) int(11) 626432
Output for 5.3.0 - 5.3.10
int(12) int(11) 626128int(12) int(11) 626128
Output for 5.2.10 - 5.2.17
int(12) int(11) 83304int(12) int(11) 83304
Output for 5.2.7 - 5.2.9
int(12) int(11) 83336int(12) int(11) 83336
Output for 5.2.3 - 5.2.6
int(12) int(11) 83656int(12) int(11) 83656
Output for 5.2.1 - 5.2.2
int(12) int(11) 81576int(12) int(11) 81576
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