3v4l.org

run code in 200+ 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); function testCopy($var) { echo memory_get_usage() . "\n"; $var = (string) $var; echo memory_get_usage() . "\n"; }
Output for 7.2.0
Static Var 384928 384928 Dynamic Var 384928 384928
Output for 7.0.0 - 7.1.0, 7.1.7
Static Var 348320 348320 Dynamic Var 348320 348320
Output for 7.1.5 - 7.1.6
Static Var 348576 348576 Dynamic Var 348576 348576
Output for 5.6.0 - 5.6.28
Static Var 219648 219704 Dynamic Var 219648 220016
Output for 5.5.0 - 5.5.36
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 624472 625408 Dynamic Var 624472 624840
Output for 5.3.0 - 5.3.10
Static Var 624168 625104 Dynamic Var 624168 624536
Output for 5.2.10 - 5.2.17
Static Var 82416 83344 Dynamic Var 82416 82776
Output for 5.2.7 - 5.2.9
Static Var 83016 84000 Dynamic Var 83112 83432
Output for 5.2.3 - 5.2.6
Static Var 83336 84320 Dynamic Var 83432 83752
Output for 5.2.2
Static Var 81232 82216 Dynamic Var 81328 81648
Output for 5.2.1
Static Var 81288 82176 Dynamic Var 81328 81648
Output for 5.0.0 - 5.2.0
Static Var Fatal error: Call to undefined function memory_get_usage() in /in/276vq 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/276vq 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/276vq 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/276vq on line 11