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

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