3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = "foo"; $b = str_repeat("a", 3); echo "Static Var\n"; testCopy($a); echo "Dynamic Var\n"; testCopy($b); function testCopy($var) { echo memory_get_usage() . "\n"; $b = (string) $var; echo memory_get_usage() . "\n"; }
Output for 7.0.0 - 7.1.0
Static Var 347120 347120 Dynamic Var 347120 347120
Output for hhvm-3.10.0 - 3.12.0
Static Var 2097152 2097152 Dynamic Var 2097152 2097152
Output for 5.6.7 - 5.6.28
Static Var 219384 219440 Dynamic Var 219384 219464
Output for 5.5.24 - 5.5.35
Static Var 219368 219440 Dynamic Var 219368 219448
Output for 5.4.0 - 5.4.45
Static Var 219888 219960 Dynamic Var 219888 219968
Output for 5.3.11 - 5.3.29
Static Var 622504 622584 Dynamic Var 622504 622584
Output for 5.3.0 - 5.3.10
Static Var 622200 622280 Dynamic Var 622200 622280
Output for 5.2.10 - 5.2.17
Static Var 80448 80616 Dynamic Var 80448 80616
Output for 5.2.7 - 5.2.9
Static Var 81048 81144 Dynamic Var 81272 81272
Output for 5.2.3 - 5.2.6
Static Var 81368 81464 Dynamic Var 81592 81592
Output for 5.2.2
Static Var 79264 79360 Dynamic Var 79488 79488
Output for 5.2.1
Static Var 79312 79408 Dynamic Var 79480 79480
Output for 5.0.0 - 5.2.0
Static Var Fatal error: Call to undefined function memory_get_usage() in /in/1bM8L on line 11
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Static Var Fatal error: Call to undefined function: memory_get_usage() in /in/1bM8L on line 11
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Static Var Fatal error: Call to undefined function: memory_get_usage() in /in/1bM8L on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Static Var Fatal error: Call to undefined function: memory_get_usage() in /in/1bM8L on line 11