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"; $var = (string) $var; echo memory_get_usage() . "\n"; }
Output for 7.0.0 - 7.1.0
Static Var 347112 347112 Dynamic Var 347112 347112
Output for 5.6.0 - 5.6.28
Static Var 219360 219416 Dynamic Var 219360 219440
Output for 5.5.0 - 5.5.38
Static Var 219344 219416 Dynamic Var 219344 219424
Output for 5.4.0 - 5.4.45
Static Var 219864 219936 Dynamic Var 219864 219944
Output for 5.3.11 - 5.3.29
Static Var 622472 622552 Dynamic Var 622472 622552
Output for 5.3.0 - 5.3.10
Static Var 622168 622248 Dynamic Var 622168 622248
Output for 5.2.10 - 5.2.17
Static Var 80416 80488 Dynamic Var 80416 80488
Output for 5.2.7 - 5.2.9
Static Var 81016 81112 Dynamic Var 81144 81144
Output for 5.2.3 - 5.2.6
Static Var 81336 81432 Dynamic Var 81464 81464
Output for 5.2.2
Static Var 79232 79328 Dynamic Var 79360 79360
Output for 5.2.1
Static Var 79280 79280 Dynamic Var 79352 79352
Output for 5.0.0 - 5.2.0
Static Var Fatal error: Call to undefined function memory_get_usage() in /in/j7evg 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/j7evg 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/j7evg 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/j7evg on line 11