3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = (object) [ 'a' => function(){ return 1; }, 'b' => (object) [ 'ba' => function(){ return 2; }, 'bb' => (object) [ 'bba' => function(){ return 3; } ] ] ]; print_r(get_class_methods('stdClass')); echo $obj->a->__invoke(); echo $obj->b->__call('ba'); $obj->b->bb->bba->__invoke();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8CiiB
function name:  (null)
number of ops:  33
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F8CiiB%3A4%240'
          1        INIT_ARRAY                                       ~2      ~1, 'a'
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F8CiiB%3A6%241'
          3        INIT_ARRAY                                       ~4      ~3, 'ba'
    8     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F8CiiB%3A8%242'
          5        INIT_ARRAY                                       ~6      ~5, 'bba'
          6        CAST                                          8  ~7      ~6
          7        ADD_ARRAY_ELEMENT                                ~4      ~7, 'bb'
          8        CAST                                          8  ~8      ~4
          9        ADD_ARRAY_ELEMENT                                ~2      ~8, 'b'
         10        CAST                                          8  ~9      ~2
    3    11        ASSIGN                                                   !0, ~9
   12    12        INIT_FCALL                                               'print_r'
         13        INIT_FCALL                                               'get_class_methods'
         14        SEND_VAL                                                 'stdClass'
         15        DO_ICALL                                         $11     
         16        SEND_VAR                                                 $11
         17        DO_ICALL                                                 
   13    18        FETCH_OBJ_R                                      ~13     !0, 'a'
         19        INIT_METHOD_CALL                                         ~13, '__invoke'
         20        DO_FCALL                                      0  $14     
         21        ECHO                                                     $14
   14    22        FETCH_OBJ_R                                      ~15     !0, 'b'
         23        INIT_METHOD_CALL                                         ~15, '__call'
         24        SEND_VAL_EX                                              'ba'
         25        DO_FCALL                                      0  $16     
         26        ECHO                                                     $16
   15    27        FETCH_OBJ_R                                      ~17     !0, 'b'
         28        FETCH_OBJ_R                                      ~18     ~17, 'bb'
         29        FETCH_OBJ_R                                      ~19     ~18, 'bba'
         30        INIT_METHOD_CALL                                         ~19, '__invoke'
         31        DO_FCALL                                      0          
         32      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F8CiiB%3A4%240

Function %00%7Bclosure%7D%2Fin%2F8CiiB%3A6%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8CiiB
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   2
          1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F8CiiB%3A6%241

Function %00%7Bclosure%7D%2Fin%2F8CiiB%3A8%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8CiiB
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   3
          1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F8CiiB%3A8%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.18 ms | 1400 KiB | 17 Q