3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = "foobarbizbazbuztestingthisout"; $b = str_repeat("a", 300); 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.2.0
Static Var 384088 384088 Dynamic Var 384088 384088
Output for 7.0.0 - 7.1.0, 7.1.7
Static Var 347480 347480 Dynamic Var 347480 347480
Output for 7.1.5 - 7.1.6
Static Var 347736 347736 Dynamic Var 347736 347736
Output for 5.6.0 - 5.6.28
Static Var 219648 219704 Dynamic Var 219648 220016
Output for 5.5.0 - 5.5.38
Static Var 219632 219680 Dynamic Var 219632 220000
Output for 5.4.0 - 5.4.45
Static Var 220152 220200 Dynamic Var 220152 220520
Output for 5.3.11 - 5.3.29
Static Var 622792 622888 Dynamic Var 622792 623160
Output for 5.3.0 - 5.3.10
Static Var 622488 622584 Dynamic Var 622488 622856
Output for 5.2.10 - 5.2.17
Static Var 80736 80824 Dynamic Var 80736 81096
Output for 5.2.7 - 5.2.9
Static Var 81336 81480 Dynamic Var 81480 81800
Output for 5.2.3 - 5.2.6
Static Var 81656 81800 Dynamic Var 81800 82120
Output for 5.2.2
Static Var 79552 79696 Dynamic Var 79696 80016
Output for 5.2.1
Static Var 79608 79656 Dynamic Var 79696 80016
Output for 5.0.0 - 5.2.0
Static Var Fatal error: Call to undefined function memory_get_usage() in /in/Mboi2 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/Mboi2 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/Mboi2 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/Mboi2 on line 11