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); function testCopy($var) { echo memory_get_usage() . "\n"; $var = (string) $var; echo memory_get_usage() . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/276vq
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'foobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisoutfoobarbizbazbuztestingthisout'
    4     1        INIT_FCALL                                               'str_repeat'
          2        SEND_VAL                                                 'a'
          3        SEND_VAL                                                 300
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    5     6        ECHO                                                     'Static+Var%0A'
    6     7        INIT_FCALL_BY_NAME                                       'testCopy'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
    7    10        ECHO                                                     'Dynamic+Var%0A'
    8    11        INIT_FCALL_BY_NAME                                       'testCopy'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   14    14      > RETURN                                                   1

Function testcopy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/276vq
function name:  testCopy
number of ops:  12
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'memory_get_usage'
          2        DO_ICALL                                         $1      
          3        CONCAT                                           ~2      $1, '%0A'
          4        ECHO                                                     ~2
   12     5        CAST                                          6  ~3      !0
          6        ASSIGN                                                   !0, ~3
   13     7        INIT_FCALL                                               'memory_get_usage'
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      $5, '%0A'
         10        ECHO                                                     ~6
   14    11      > RETURN                                                   null

End of function testcopy

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.84 ms | 1461 KiB | 15 Q