3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyNode { public $name; public $children = array(); public $parent; public function __construct(string $name, $parent) { echo "in constructor\n"; $this->name = $name; echo "name: " . $this->name . ".\n"; $this->parent = $parent; echo "parent: " . $this->parent . ".\n"; } public function __toString() { return $this->name; } } $RootNode = new MyNode("Root", null); echo "done root x\n"; $ChildNode = new MyNode("Child1", $RootNode); echo "done child\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rfiJe
function name:  (null)
number of ops:  14
compiled vars:  !0 = $RootNode, !1 = $ChildNode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'mynode'
   21     1        NEW                                              $2      'MyNode'
          2        SEND_VAL_EX                                              'Root'
          3        SEND_VAL_EX                                              null
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   22     6        ECHO                                                     'done+root+x%0A'
   23     7        NEW                                              $5      'MyNode'
          8        SEND_VAL_EX                                              'Child1'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $5
   24    12        ECHO                                                     'done+child%0A'
         13      > RETURN                                                   1

Class MyNode:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rfiJe
function name:  __construct
number of ops:  16
compiled vars:  !0 = $name, !1 = $parent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ECHO                                                     'in+constructor%0A'
    9     3        ASSIGN_OBJ                                               'name'
          4        OP_DATA                                                  !0
   10     5        FETCH_OBJ_R                                      ~3      'name'
          6        CONCAT                                           ~4      'name%3A+', ~3
          7        CONCAT                                           ~5      ~4, '.%0A'
          8        ECHO                                                     ~5
   11     9        ASSIGN_OBJ                                               'parent'
         10        OP_DATA                                                  !1
   12    11        FETCH_OBJ_R                                      ~7      'parent'
         12        CONCAT                                           ~8      'parent%3A+', ~7
         13        CONCAT                                           ~9      ~8, '.%0A'
         14        ECHO                                                     ~9
   13    15      > RETURN                                                   null

End of function __construct

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

End of function __tostring

End of class MyNode.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.24 ms | 1074 KiB | 13 Q