3v4l.org

run code in 300+ PHP versions simultaneously
<?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($c) - 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.3.0 - 7.3.12
Static Var 389416 389416 Dynamic Var 389416 389416 Notice: Undefined variable: c in /in/AprM3 on line 9 390312
Output for 7.2.0 - 7.2.24
Static Var 385360 385360 Dynamic Var 385360 385360 Notice: Undefined variable: c in /in/AprM3 on line 9 386256
Output for 7.1.25 - 7.1.33
Static Var 348752 348752 Dynamic Var 348752 348752 Notice: Undefined variable: c in /in/AprM3 on line 9 349648
Output for 7.0.0 - 7.0.20, 7.1.0, 7.1.7
Static Var 348824 348824 Dynamic Var 348824 348824 Notice: Undefined variable: c in /in/AprM3 on line 9 349720
Output for 7.1.5 - 7.1.6
Static Var 349200 349200 Dynamic Var 349200 349200 Notice: Undefined variable: c in /in/AprM3 on line 9 350096
Output for 5.6.0 - 5.6.28
Static Var 220464 220512 Dynamic Var 220464 220832 Notice: Undefined variable: c in /in/AprM3 on line 9 221496
Output for 5.5.0 - 5.5.37
Static Var 220448 220496 Dynamic Var 220448 220816 Notice: Undefined variable: c in /in/AprM3 on line 9 221480
Output for 5.4.0 - 5.4.45
Static Var 220968 221016 Dynamic Var 220968 221336 Notice: Undefined variable: c in /in/AprM3 on line 9 222000
Output for 5.3.11 - 5.3.29
Static Var 625960 626896 Dynamic Var 625960 626328 Notice: Undefined variable: c in /in/AprM3 on line 9 627000
Output for 5.3.0 - 5.3.10
Static Var 625656 626592 Dynamic Var 625656 626024 Notice: Undefined variable: c in /in/AprM3 on line 9 626696
Output for 5.2.10 - 5.2.17
Static Var 83904 84832 Dynamic Var 83904 84264 Notice: Undefined variable: c in /in/AprM3 on line 9 84840
Output for 5.2.7 - 5.2.9
Static Var 84504 85488 Dynamic Var 84600 84920 Notice: Undefined variable: c in /in/AprM3 on line 9 85856
Output for 5.2.3 - 5.2.6
Static Var 84824 85808 Dynamic Var 84920 85240 Notice: Undefined variable: c in /in/AprM3 on line 9 86176
Output for 5.2.2
Static Var 82720 83704 Dynamic Var 82816 83136 Notice: Undefined variable: c in /in/AprM3 on line 9 84072
Output for 5.2.1
Static Var 82768 83656 Dynamic Var 82808 83128 Notice: Undefined variable: c in /in/AprM3 on line 9 83800
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Static Var Fatal error: Call to undefined function memory_get_usage() in /in/AprM3 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/AprM3 on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Static Var Fatal error: Call to undefined function: memory_get_usage() in /in/AprM3 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/AprM3 on line 13

preferences:
211.19 ms | 401 KiB | 257 Q