3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Menu { private $menus = []; private $name; public function __construct($name) { $this->name = $name; } public function addMenu(self $menu) { $this->menus[] = $menu; } public function getMenus() { return $this->menus; } public function __toString() { return $this->name; } } $menu1 = new Menu('Top Level Menu'); $menu1->addMenu(new Menu('Child Menu')); var_dump($menu1->getMenus());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C0h3W
function name:  (null)
number of ops:  17
compiled vars:  !0 = $menu1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'menu'
   22     1        NEW                                              $1      'Menu'
          2        SEND_VAL_EX                                              'Top+Level+Menu'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   23     5        INIT_METHOD_CALL                                         !0, 'addMenu'
          6        NEW                                              $4      'Menu'
          7        SEND_VAL_EX                                              'Child+Menu'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $4
         10        DO_FCALL                                      0          
   25    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getMenus'
         13        DO_FCALL                                      0  $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Menu:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C0h3W
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

Function addmenu:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C0h3W
function name:  addMenu
number of ops:  5
compiled vars:  !0 = $menu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        FETCH_OBJ_W                                      $1      'menus'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
   15     4      > RETURN                                                   null

End of function addmenu

Function getmenus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C0h3W
function name:  getMenus
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'menus'
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function getmenus

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C0h3W
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
          3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function __tostring

End of class Menu.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.34 ms | 1400 KiB | 15 Q