3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(&$str) { $str = 'xyz'; return $str; } $o = "abc"; // No errors foo($o); call_user_func('foo', $o); call_user_func('foo', [$o]); $a[] = "abc"; $a[] = "abc"; $a[] = "abc"; // Warning: Parameter 1 to foo() expected to be a reference, value given in call_user_func('foo', array_slice($a, 0, 1)); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KNM3k
function name:  (null)
number of ops:  29
compiled vars:  !0 = $o, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'abc'
   10     1        INIT_FCALL                                               'foo'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
   11     4        INIT_FCALL                                               'foo'
          5        SEND_USER                                                !0
          6        DO_FCALL                                      0          
   12     7        INIT_FCALL                                               'foo'
          8        INIT_ARRAY                                       ~5      !0
          9        SEND_USER                                                ~5
         10        DO_FCALL                                      0          
   15    11        ASSIGN_DIM                                               !1
         12        OP_DATA                                                  'abc'
   16    13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  'abc'
   17    15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  'abc'
   19    17        INIT_FCALL                                               'foo'
         18        INIT_FCALL                                               'array_slice'
         19        SEND_VAR                                                 !1
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $10     
         23        SEND_USER                                                $10
         24        DO_FCALL                                      0          
   21    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !1
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KNM3k
function name:  foo
number of ops:  4
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !0, 'xyz'
    5     2      > RETURN                                                   !0
    6     3*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.83 ms | 1399 KiB | 21 Q