3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DICT { // список объектов private $objects = []; // создание объекта public function __set($name, $value){ if( !isset( $this->objects[$name] ) ){ $this->objects[$name] = $value; }else{ echo 'DICT name "'. $name .'" is already exist!'; } } // вызов объекта public function __call($name, $args){ if( isset( $this->objects[$name] ) ){ return call_user_func_array($this->objects[$name], $args); }else{ echo 'DICT name "'. $name .'" is not exist!'; } } } $a = new DICT; $a->b = function(){ echo 'b'; }; $a->c = new DICT; $a->b(); // работает $a->c->d = function(){ echo 'd'; }; $a->c->d();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAa12
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'DICT'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeAa12%3A29%240'
          4        ASSIGN_OBJ                                               !0, 'b'
          5        OP_DATA                                                  ~5
   30     6        NEW                                              $7      'DICT'
          7        DO_FCALL                                      0          
          8        ASSIGN_OBJ                                               !0, 'c'
          9        OP_DATA                                                  $7
   31    10        INIT_METHOD_CALL                                         !0, 'b'
         11        DO_FCALL                                      0          
   32    12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeAa12%3A32%241'
         13        FETCH_OBJ_W                                      $10     !0, 'c'
         14        ASSIGN_OBJ                                               $10, 'd'
         15        OP_DATA                                                  ~12
   33    16        FETCH_OBJ_R                                      ~13     !0, 'c'
         17        INIT_METHOD_CALL                                         ~13, 'd'
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FeAa12%3A29%240

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

End of function %00%7Bclosure%7D%2Fin%2FeAa12%3A32%241

Class DICT:
Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAa12
function name:  __set
number of ops:  14
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_OBJ_IS                                     ~2      'objects'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      ~2, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->10
   11     6    >   FETCH_OBJ_W                                      $5      'objects'
          7        ASSIGN_DIM                                               $5, !0
          8        OP_DATA                                                  !1
          9      > JMP                                                      ->13
   13    10    >   CONCAT                                           ~7      'DICT+name+%22', !0
         11        CONCAT                                           ~8      ~7, '%22+is+already+exist%21'
         12        ECHO                                                     ~8
   15    13    > > RETURN                                                   null

End of function __set

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eAa12
function name:  __call
number of ops:  17
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        FETCH_OBJ_IS                                     ~2      'objects'
          3        ISSET_ISEMPTY_DIM_OBJ                         0          ~2, !0
          4      > JMPZ                                                     ~3, ->13
   20     5    >   FETCH_OBJ_R                                      ~4      'objects'
          6        FETCH_DIM_R                                      ~5      ~4, !0
          7        INIT_USER_CALL                                0          'call_user_func_array', ~5
          8        SEND_ARRAY                                               !1
          9        CHECK_UNDEF_ARGS                                         
         10        DO_FCALL                                      0  $6      
         11      > RETURN                                                   $6
         12*       JMP                                                      ->16
   22    13    >   CONCAT                                           ~7      'DICT+name+%22', !0
         14        CONCAT                                           ~8      ~7, '%22+is+not+exist%21'
         15        ECHO                                                     ~8
   24    16      > RETURN                                                   null

End of function __call

End of class DICT.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.97 ms | 1399 KiB | 13 Q