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); } } $d = new Dynamic; $d->anotherMethod = function(){ return "Hey there"; }; $d->anotherMethod();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PJuVl
function name:  (null)
number of ops:  9
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'Dynamic'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   12     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPJuVl%3A12%240'
          4        ASSIGN_OBJ                                               !0, 'anotherMethod'
   14     5        OP_DATA                                                  ~5
   15     6        INIT_METHOD_CALL                                         !0, 'anotherMethod'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FPJuVl%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/PJuVl
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:
169.73 ms | 1399 KiB | 13 Q