3v4l.org

run code in 300+ PHP versions simultaneously
<?php class stdobject { public function __call($method, $arguments) { if (isset($this->{$method}) && is_callable($this->{$method})) { return call_user_func_array($this->{$method}, $arguments); } else { throw new Exception("Fatal error: Call to undefined method: $method"); } } } $mod = function() { $test = new stdobject(); $opmode=null; $mode='somemode'; $ref2=&$mode; $test->init = function ($params) use (&$opmode) { $opmode = &$params['opmode']; }; $test->setup = function () use (&$opmode,&$mode) { $opmode = 'test'; $mode='someothermode'; }; $test->print=function() use (&$opmode,&$mode){ echo $opmode; echo $mode; }; return $test; }; $test = $mod(); $opmode = 'helloworld'; $test->init(['opmode' => &$opmode]); $test->setup(); $test->print(); echo $opmode;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3YEkB
function name:  (null)
number of ops:  16
compiled vars:  !0 = $mod, !1 = $test, !2 = $opmode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3YEkB%3A13%240'
          1        ASSIGN                                                   !0, ~3
   36     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $5      
          4        ASSIGN                                                   !1, $5
   38     5        ASSIGN                                                   !2, 'helloworld'
   40     6        INIT_METHOD_CALL                                         !1, 'init'
          7        INIT_ARRAY                                       ~8      !2, 'opmode'
          8        SEND_VAL_EX                                              ~8
          9        DO_FCALL                                      0          
   41    10        INIT_METHOD_CALL                                         !1, 'setup'
         11        DO_FCALL                                      0          
   42    12        INIT_METHOD_CALL                                         !1, 'print'
         13        DO_FCALL                                      0          
   44    14        ECHO                                                     !2
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F3YEkB%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3YEkB
function name:  {closure}
number of ops:  22
compiled vars:  !0 = $test, !1 = $opmode, !2 = $mode, !3 = $ref2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $4      'stdobject'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   16     3        ASSIGN                                                   !1, null
   17     4        ASSIGN                                                   !2, 'somemode'
   18     5        ASSIGN_REF                                               !3, !2
   20     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3YEkB%3A20%241'
          7        BIND_LEXICAL                                             ~11, !1
          8        ASSIGN_OBJ                                               !0, 'init'
   22     9        OP_DATA                                                  ~11
   24    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3YEkB%3A24%242'
         11        BIND_LEXICAL                                             ~13, !1
         12        BIND_LEXICAL                                             ~13, !2
         13        ASSIGN_OBJ                                               !0, 'setup'
   27    14        OP_DATA                                                  ~13
   29    15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3YEkB%3A29%243'
         16        BIND_LEXICAL                                             ~15, !1
         17        BIND_LEXICAL                                             ~15, !2
         18        ASSIGN_OBJ                                               !0, 'print'
   32    19        OP_DATA                                                  ~15
   34    20      > RETURN                                                   !0
   35    21*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F3YEkB%3A13%240

Function %00%7Bclosure%7D%2Fin%2F3YEkB%3A20%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3YEkB
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $params, !1 = $opmode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   21     2        FETCH_DIM_W                                      $2      !0, 'opmode'
          3        ASSIGN_REF                                               !1, $2
   22     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F3YEkB%3A20%241

Function %00%7Bclosure%7D%2Fin%2F3YEkB%3A24%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3YEkB
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $opmode, !1 = $mode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   25     2        ASSIGN                                                   !0, 'test'
   26     3        ASSIGN                                                   !1, 'someothermode'
   27     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F3YEkB%3A24%242

Function %00%7Bclosure%7D%2Fin%2F3YEkB%3A29%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3YEkB
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $opmode, !1 = $mode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   30     2        ECHO                                                     !0
   31     3        ECHO                                                     !1
   32     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F3YEkB%3A29%243

Class stdobject:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 9
filename:       /in/3YEkB
function name:  __call
number of ops:  24
compiled vars:  !0 = $method, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ISSET_ISEMPTY_PROP_OBJ                           ~2      !0
          3      > JMPZ_EX                                          ~2      ~2, ->9
          4    >   INIT_FCALL                                               'is_callable'
          5        FETCH_OBJ_R                                      ~3      !0
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8        BOOL                                             ~2      $4
          9    > > JMPZ                                                     ~2, ->17
    6    10    >   FETCH_OBJ_R                                      ~5      !0
         11        INIT_USER_CALL                                0          'call_user_func_array', ~5
         12        SEND_ARRAY                                               !1
         13        CHECK_UNDEF_ARGS                                         
         14        DO_FCALL                                      0  $6      
         15      > RETURN                                                   $6
         16*       JMP                                                      ->23
    8    17    >   NEW                                              $7      'Exception'
         18        NOP                                                      
         19        FAST_CONCAT                                      ~8      'Fatal+error%3A+Call+to+undefined+method%3A+', !0
         20        SEND_VAL_EX                                              ~8
         21        DO_FCALL                                      0          
         22      > THROW                                         0          $7
   10    23*     > RETURN                                                   null

End of function __call

End of class stdobject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.98 ms | 1404 KiB | 15 Q