3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } class C { function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } } class S { static function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } } $vv["'foo'"] = 'foo'; $vv["['S', 'foo']"] = ['S', 'foo']; $vv["[new C, 'foo']"] = [new C, 'foo']; $vv["function(..){..}"] = function(&$a, $b) { $a = 'modified'; $b = 'modified'; }; $vv["'S::foo'"] = 'S::foo'; foreach ($vv as $label => $v) { print $label; print is_callable($v) ? 'is callable' : 'is not callable'; print "\n"; $a = 'orig'; $b = 'orig'; call_user_func_array($v, array(&$a, &$b)); assert($a === 'modified'); assert($b === 'orig'); $a = 'orig'; $b = 'orig'; $v($a, $b); assert($a === 'modified'); assert($b === 'orig'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 67
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 67
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
filename:       /in/KFAGV
function name:  (null)
number of ops:  69
compiled vars:  !0 = $vv, !1 = $v, !2 = $label, !3 = $a, !4 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ASSIGN_DIM                                               !0, '%27foo%27'
          1        OP_DATA                                                  'foo'
   23     2        ASSIGN_DIM                                               !0, '%5B%27S%27%2C+%27foo%27%5D'
          3        OP_DATA                                                  <array>
   24     4        NEW                                              $8      'C'
          5        DO_FCALL                                      0          
          6        INIT_ARRAY                                       ~10     $8
          7        ADD_ARRAY_ELEMENT                                ~10     'foo'
          8        ASSIGN_DIM                                               !0, '%5Bnew+C%2C+%27foo%27%5D'
          9        OP_DATA                                                  ~10
   25    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKFAGV%3A25%240'
         11        ASSIGN_DIM                                               !0, 'function%28..%29%7B..%7D'
   28    12        OP_DATA                                                  ~12
   29    13        ASSIGN_DIM                                               !0, '%27S%3A%3Afoo%27'
         14        OP_DATA                                                  'S%3A%3Afoo'
   31    15      > FE_RESET_R                                       $14     !0, ->67
         16    > > FE_FETCH_R                                       ~15     $14, !1, ->67
         17    >   ASSIGN                                                   !2, ~15
   32    18        ECHO                                                     !2
   33    19        INIT_FCALL                                               'is_callable'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $17     
         22      > JMPZ                                                     $17, ->25
         23    >   QM_ASSIGN                                        ~18     'is+callable'
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~18     'is+not+callable'
         26    >   ECHO                                                     ~18
   34    27        ECHO                                                     '%0A'
   36    28        ASSIGN                                                   !3, 'orig'
   37    29        ASSIGN                                                   !4, 'orig'
   38    30        INIT_USER_CALL                                0          'call_user_func_array', !1
         31        INIT_ARRAY                                       ~21     !3
         32        ADD_ARRAY_ELEMENT                                ~21     !4
         33        SEND_ARRAY                                               ~21
         34        CHECK_UNDEF_ARGS                                         
         35        DO_FCALL                                      0          
   39    36        ASSERT_CHECK                                             
         37        INIT_FCALL                                               'assert'
         38        IS_IDENTICAL                                     ~23     !3, 'modified'
         39        SEND_VAL                                                 ~23
         40        SEND_VAL                                                 'assert%28%24a+%3D%3D%3D+%27modified%27%29'
         41        DO_ICALL                                                 
   40    42        ASSERT_CHECK                                             
         43        INIT_FCALL                                               'assert'
         44        IS_IDENTICAL                                     ~25     !4, 'orig'
         45        SEND_VAL                                                 ~25
         46        SEND_VAL                                                 'assert%28%24b+%3D%3D%3D+%27orig%27%29'
         47        DO_ICALL                                                 
   42    48        ASSIGN                                                   !3, 'orig'
   43    49        ASSIGN                                                   !4, 'orig'
   44    50        INIT_DYNAMIC_CALL                                        !1
         51        SEND_VAR_EX                                              !3
         52        SEND_VAR_EX                                              !4
         53        DO_FCALL                                      0          
   45    54        ASSERT_CHECK                                             
         55        INIT_FCALL                                               'assert'
         56        IS_IDENTICAL                                     ~30     !3, 'modified'
         57        SEND_VAL                                                 ~30
         58        SEND_VAL                                                 'assert%28%24a+%3D%3D%3D+%27modified%27%29'
         59        DO_ICALL                                                 
   46    60        ASSERT_CHECK                                             
         61        INIT_FCALL                                               'assert'
         62        IS_IDENTICAL                                     ~32     !4, 'orig'
         63        SEND_VAL                                                 ~32
         64        SEND_VAL                                                 'assert%28%24b+%3D%3D%3D+%27orig%27%29'
         65        DO_ICALL                                                 
   31    66      > JMP                                                      ->16
         67    >   FE_FREE                                                  $14
   47    68      > RETURN                                                   1

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

End of function foo

Function %00%7Bclosure%7D%2Fin%2FKFAGV%3A25%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KFAGV
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2        ASSIGN                                                   !0, 'modified'
   27     3        ASSIGN                                                   !1, 'modified'
   28     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKFAGV%3A25%240

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

End of function foo

End of class C.

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

End of function foo

End of class S.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.59 ms | 1415 KiB | 17 Q