3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface INode { public function connectToEdge(Edge $edge); } final class Node extends Nette\Object implements INode { private $name; private $value = null; private $edges = array(); public function __construct($name, $value = null) { $this->name = $name; $this->value = $value; } public function getName() { return $this->name; } public function getValue() { return $this->value; } public function connectToEdge(Edge $edge) { $this->edges[spl_object_hash($edge)] = $edge; } } final class Edge extends Nette\Object { private $nodeFrom; private $nodeTo; private $directional = true; private $name = null; public function __construct(Node $nodeFrom, Node $nodeTo, $directional = true, $name = null) { $this->nodeFrom = $nodeFrom; $this->nodeTo = $nodeTo; $this->directional = $directional; $this->name = $name; $this->nodeFrom->connectToEdge($this); $this->nodeTo->connectToEdge($this); } } $node1 = new Node('uzel_1'); $node2 = new Node('uzel_2'); $edge1 = new Edge($node1, $node2, true, 'hrana mezi uzel_1 - uzel_2'); $edge2 = new Edge($node1, $node2, true, 'hrana mezi uzel_1 - uzel_2 v2'); dump(spl_object_hash($edge1)); dump(spl_object_hash($edge2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3Blj
function name:  (null)
number of ops:  37
compiled vars:  !0 = $node1, !1 = $node2, !2 = $edge1, !3 = $edge2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'node', 'nette%5Cobject'
   38     1        DECLARE_CLASS                                            'edge', 'nette%5Cobject'
   58     2        NEW                                              $4      'Node'
          3        SEND_VAL_EX                                              'uzel_1'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
   59     6        NEW                                              $7      'Node'
          7        SEND_VAL_EX                                              'uzel_2'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   60    10        NEW                                              $10     'Edge'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        SEND_VAL_EX                                              <true>
         14        SEND_VAL_EX                                              'hrana+mezi+uzel_1+-+uzel_2'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $10
   61    17        NEW                                              $13     'Edge'
         18        SEND_VAR_EX                                              !0
         19        SEND_VAR_EX                                              !1
         20        SEND_VAL_EX                                              <true>
         21        SEND_VAL_EX                                              'hrana+mezi+uzel_1+-+uzel_2+v2'
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $13
   64    24        INIT_FCALL_BY_NAME                                       'dump'
         25        INIT_FCALL                                               'spl_object_hash'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $16     
         28        SEND_VAR_NO_REF_EX                                       $16
         29        DO_FCALL                                      0          
   65    30        INIT_FCALL_BY_NAME                                       'dump'
         31        INIT_FCALL                                               'spl_object_hash'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                         $18     
         34        SEND_VAR_NO_REF_EX                                       $18
         35        DO_FCALL                                      0          
         36      > RETURN                                                   1

Class INode:
Function connecttoedge:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3Blj
function name:  connectToEdge
number of ops:  2
compiled vars:  !0 = $edge
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function connecttoedge

End of class INode.

Class Node:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3Blj
function name:  __construct
number of ops:  7
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   17     2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  !0
   18     4        ASSIGN_OBJ                                               'value'
          5        OP_DATA                                                  !1
   19     6      > RETURN                                                   null

End of function __construct

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

End of function getname

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

End of function getvalue

Function connecttoedge:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3Blj
function name:  connectToEdge
number of ops:  8
compiled vars:  !0 = $edge
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        INIT_FCALL                                               'spl_object_hash'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        FETCH_OBJ_W                                      $1      'edges'
          5        ASSIGN_DIM                                               $1, $2
          6        OP_DATA                                                  !0
   34     7      > RETURN                                                   null

End of function connecttoedge

End of class Node.

Class Edge:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N3Blj
function name:  __construct
number of ops:  23
compiled vars:  !0 = $nodeFrom, !1 = $nodeTo, !2 = $directional, !3 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <true>
          3        RECV_INIT                                        !3      null
   47     4        ASSIGN_OBJ                                               'nodeFrom'
          5        OP_DATA                                                  !0
   48     6        ASSIGN_OBJ                                               'nodeTo'
          7        OP_DATA                                                  !1
   49     8        ASSIGN_OBJ                                               'directional'
          9        OP_DATA                                                  !2
   50    10        ASSIGN_OBJ                                               'name'
         11        OP_DATA                                                  !3
   52    12        FETCH_OBJ_R                                      ~8      'nodeFrom'
         13        INIT_METHOD_CALL                                         ~8, 'connectToEdge'
         14        FETCH_THIS                                       $9      
         15        SEND_VAR_EX                                              $9
         16        DO_FCALL                                      0          
   53    17        FETCH_OBJ_R                                      ~11     'nodeTo'
         18        INIT_METHOD_CALL                                         ~11, 'connectToEdge'
         19        FETCH_THIS                                       $12     
         20        SEND_VAR_EX                                              $12
         21        DO_FCALL                                      0          
   54    22      > RETURN                                                   null

End of function __construct

End of class Edge.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.98 ms | 1404 KiB | 15 Q