3v4l.org

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

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

End of function %00%7Bclosure%7D%2Fin%2FJ39XV%3A21%240

Class SomeClass:
Function staticmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J39XV
function name:  staticMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ECHO                                                     'SomeClass%3A%3AstaticMethod%28%29'
    5     1      > RETURN                                                   null

End of function staticmethod

End of class SomeClass.

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/J39XV
function name:  __call
number of ops:  23
compiled vars:  !0 = $key, !1 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ISSET_ISEMPTY_PROP_OBJ                           ~2      !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->15
   12     5    >   NEW                                              $4      'Exception'
          6        FETCH_THIS                                       ~5      
          7        GET_CLASS                                        ~6      ~5
          8        CONCAT                                           ~7      'Call+to+undefined+method+', ~6
          9        CONCAT                                           ~8      ~7, '%3A%3A'
         10        CONCAT                                           ~9      ~8, !0
         11        CONCAT                                           ~10     ~9, '%28%29'
         12        SEND_VAL_EX                                              ~10
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $4
   13    15    >   FETCH_THIS                                       ~12     
         16        FETCH_R                      local               ~13     ~12
         17        FETCH_OBJ_R                                      ~14     ~13, !0
         18        INIT_USER_CALL                                0          'call_user_func_array', ~14
         19        SEND_ARRAY                                               !1
         20        CHECK_UNDEF_ARGS                                         
         21        DO_FCALL                                      0          
   14    22      > RETURN                                                   null

End of function __call

End of class Dynamic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.26 ms | 1399 KiB | 13 Q