3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = "foobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisout"; $b = str_repeat("a", 300); echo "Static Var\n"; testCopy($a); echo "Dynamic Var\n"; testCopy($b); $c = mb_substr($a, 0, strlen($a) - 1); echo memory_get_usage() . "\n"; 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 348824 348824 Dynamic Var 348824 348824 349720
Output for hhvm-3.10.0 - 3.12.0
Static Var 2097152 2097152 Dynamic Var 2097152 2097152 2097152
Output for 5.6.0 - 5.6.28
Static Var 220464 220512 Dynamic Var 220464 220832 221496
Output for 5.5.0 - 5.5.38
Static Var 220448 220496 Dynamic Var 220448 220816 221488
Output for 5.4.0 - 5.4.45
Static Var 220968 221016 Dynamic Var 220968 221336 222008
Output for 5.3.11 - 5.3.29
Static Var 625960 626896 Dynamic Var 625960 626328 627000
Output for 5.3.0 - 5.3.10
Static Var 625656 626592 Dynamic Var 625656 626024 626696
Output for 5.2.10 - 5.2.17
Static Var 83904 84832 Dynamic Var 83904 84264 84840
Output for 5.2.7 - 5.2.9
Static Var 84504 85488 Dynamic Var 84600 84920 85856
Output for 5.2.3 - 5.2.6
Static Var 84824 85808 Dynamic Var 84920 85240 86176
Output for 5.2.2
Static Var 82720 83704 Dynamic Var 82816 83136 84072
Output for 5.2.1
Static Var 82768 83656 Dynamic Var 82808 83128 83704
Output for 5.0.0 - 5.2.0
Static Var Fatal error: Call to undefined function memory_get_usage() in /in/AAQ8R on line 13
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/AAQ8R on line 13
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/AAQ8R on line 13
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/AAQ8R on line 13