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; } } class SubMenu extends Menu {} $menu1 = new Menu('Top Level Menu'); $menu1->addMenu(new Menu('Child Menu')); $menu1->addMenu(new SubMenu('Sub Menu')); foreach ($menu1->getMenus() as $menu) { echo "{$menu}<br />"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/YrK6d
function name:  (null)
number of ops:  28
compiled vars:  !0 = $menu1, !1 = $menu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'menu'
   22     1        DECLARE_CLASS                                            'submenu', 'menu'
   24     2        NEW                                              $2      'Menu'
          3        SEND_VAL_EX                                              'Top+Level+Menu'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   25     6        INIT_METHOD_CALL                                         !0, 'addMenu'
          7        NEW                                              $5      'Menu'
          8        SEND_VAL_EX                                              'Child+Menu'
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $5
         11        DO_FCALL                                      0          
   26    12        INIT_METHOD_CALL                                         !0, 'addMenu'
         13        NEW                                              $8      'SubMenu'
         14        SEND_VAL_EX                                              'Sub+Menu'
         15        DO_FCALL                                      0          
         16        SEND_VAR_NO_REF_EX                                       $8
         17        DO_FCALL                                      0          
   28    18        INIT_METHOD_CALL                                         !0, 'getMenus'
         19        DO_FCALL                                      0  $11     
         20      > FE_RESET_R                                       $12     $11, ->26
         21    > > FE_FETCH_R                                               $12, !1, ->26
   29    22    >   NOP                                                      
         23        FAST_CONCAT                                      ~13     !1, '%3Cbr+%2F%3E'
         24        ECHO                                                     ~13
   28    25      > JMP                                                      ->21
         26    >   FE_FREE                                                  $12
   30    27      > RETURN                                                   1

Class Menu:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YrK6d
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/YrK6d
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/YrK6d
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/YrK6d
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.

Class SubMenu: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.66 ms | 1399 KiB | 13 Q