3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
Jump found. 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 >   NOP                                                      
  22     1        NEW                                              $2      :-6
         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      :-1
         7        SEND_VAL_EX                                              'Child+Menu'
         8        DO_FCALL                                      0          
         9        SEND_VAR_NO_REF                               0          $5
        10        DO_FCALL                                      0          
  25    11        INIT_FCALL                                               'var_dump'
        12        INIT_METHOD_CALL                                         !0, 'getMenus'
        13        DO_FCALL                                      0  $8      
        14        SEND_VAR                                                 $8
        15        DO_ICALL                                                 
        16      > RETURN                                                   1

Class Menu:
Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. 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
Jump found. 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
Jump found. 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
Jump found. Position 1 = -2
filename:       /in/C0h3W
function name:  __toString
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  19     0  E >   FETCH_OBJ_R                                      $0      'name'
         1      > RETURN                                                   $0
         2*     > RETURN                                                   null

End of function __tostring

End of class Menu.

Generated using Vulcan Logic Dumper, using php 7.1.0