3v4l.org

run code in 300+ PHP versions simultaneously
<?php function call($o, $arg, $refe, $context) { if (is_array($o)) { $ref = new \MethodReflection($o[0], $o[1]); } else { $ref = new \MethodReflection($o, '__invoke'); } return $ref->invokeArgs($o); } class Foo_630ce62de0a20b75afc96e69c78fe466 { private function foo() { return 'foo'; } public function __invoke() { $a = array($this, 'foo'); return call($a, array(), array(), isset($this) ? $this : null); } } $a = new Foo_630ce62de0a20b75afc96e69c78fe466(); echo call($a, array(), array(), isset($this) ? $this : null);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpH3k
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Foo_630ce62de0a20b75afc96e69c78fe466'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_FCALL                                               'call'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <array>
          6        SEND_VAL                                                 <array>
          7        ISSET_ISEMPTY_THIS                               ~4      
          8      > JMPZ                                                     ~4, ->12
          9    >   FETCH_THIS                                       ~5      
         10        QM_ASSIGN                                        ~6      ~5
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~6      null
         13    >   SEND_VAL                                                 ~6
         14        DO_FCALL                                      0  $7      
         15        ECHO                                                     $7
         16      > RETURN                                                   1

Function call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpH3k
function name:  call
number of ops:  26
compiled vars:  !0 = $o, !1 = $arg, !2 = $refe, !3 = $context, !4 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    4     4        TYPE_CHECK                                  128          !0
          5      > JMPZ                                                     ~5, ->16
    5     6    >   NEW                                              $6      'MethodReflection'
          7        CHECK_FUNC_ARG                                           
          8        FETCH_DIM_FUNC_ARG                               $7      !0, 0
          9        SEND_FUNC_ARG                                            $7
         10        CHECK_FUNC_ARG                                           
         11        FETCH_DIM_FUNC_ARG                               $8      !0, 1
         12        SEND_FUNC_ARG                                            $8
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !4, $6
         15      > JMP                                                      ->21
    7    16    >   NEW                                              $11     'MethodReflection'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAL_EX                                              '__invoke'
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !4, $11
   10    21    >   INIT_METHOD_CALL                                         !4, 'invokeArgs'
         22        SEND_VAR_EX                                              !0
         23        DO_FCALL                                      0  $14     
         24      > RETURN                                                   $14
   11    25*     > RETURN                                                   null

End of function call

Class Foo_630ce62de0a20b75afc96e69c78fe466:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpH3k
function name:  foo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   'foo'
   18     1*     > RETURN                                                   null

End of function foo

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MpH3k
function name:  __invoke
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_THIS                                       ~1      
          1        INIT_ARRAY                                       ~2      ~1
          2        ADD_ARRAY_ELEMENT                                ~2      'foo'
          3        ASSIGN                                                   !0, ~2
   22     4        INIT_FCALL                                               'call'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 <array>
          7        SEND_VAL                                                 <array>
          8        ISSET_ISEMPTY_THIS                               ~4      
          9      > JMPZ                                                     ~4, ->13
         10    >   FETCH_THIS                                       ~5      
         11        QM_ASSIGN                                        ~6      ~5
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~6      null
         14    >   SEND_VAL                                                 ~6
         15        DO_FCALL                                      0  $7      
         16      > RETURN                                                   $7
   23    17*     > RETURN                                                   null

End of function __invoke

End of class Foo_630ce62de0a20b75afc96e69c78fe466.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.58 ms | 1402 KiB | 15 Q