3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Dynamic extends stdClass{ public function __call($key,$params){ if(!isset($this->{$key})) throw new Exception("Call to undefined method ".get_class($this)."::".$key."()"); $subject = $this->{$key}; call_user_func_array($subject,$params); } } $dynamic->myMethod = "thatFunction"; $dynamic->hisMethod = array($instance,"aMethod"); $dynamic->newMethod = array(SomeClass,"staticMethod"); $dynamic->anotherMethod = function(){ echo "Hey there"; };
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6D88
function name:  (null)
number of ops:  15
compiled vars:  !0 = $dynamic, !1 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               !0, 'myMethod'
          1        OP_DATA                                                  'thatFunction'
   10     2        INIT_ARRAY                                       ~4      !1
          3        ADD_ARRAY_ELEMENT                                ~4      'aMethod'
          4        ASSIGN_OBJ                                               !0, 'hisMethod'
          5        OP_DATA                                                  ~4
   11     6        FETCH_CONSTANT                                   ~6      'SomeClass'
          7        INIT_ARRAY                                       ~7      ~6
          8        ADD_ARRAY_ELEMENT                                ~7      'staticMethod'
          9        ASSIGN_OBJ                                               !0, 'newMethod'
         10        OP_DATA                                                  ~7
   12    11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FF6D88%3A12%240'
         12        ASSIGN_OBJ                                               !0, 'anotherMethod'
   14    13        OP_DATA                                                  ~9
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FF6D88%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6D88
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ECHO                                                     'Hey+there'
   14     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FF6D88%3A12%240

Class Dynamic:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6D88
function name:  __call
number of ops:  22
compiled vars:  !0 = $key, !1 = $params, !2 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ISSET_ISEMPTY_PROP_OBJ                           ~3      !0
          3        BOOL_NOT                                         ~4      ~3
          4      > JMPZ                                                     ~4, ->15
          5    >   NEW                                              $5      'Exception'
          6        FETCH_THIS                                       ~6      
          7        GET_CLASS                                        ~7      ~6
          8        CONCAT                                           ~8      'Call+to+undefined+method+', ~7
          9        CONCAT                                           ~9      ~8, '%3A%3A'
         10        CONCAT                                           ~10     ~9, !0
         11        CONCAT                                           ~11     ~10, '%28%29'
         12        SEND_VAL_EX                                              ~11
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $5
    5    15    >   FETCH_OBJ_R                                      ~13     !0
         16        ASSIGN                                                   !2, ~13
    6    17        INIT_USER_CALL                                0          'call_user_func_array', !2
         18        SEND_ARRAY                                               !1
         19        CHECK_UNDEF_ARGS                                         
         20        DO_FCALL                                      0          
    7    21      > RETURN                                                   null

End of function __call

End of class Dynamic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
260.8 ms | 1399 KiB | 14 Q