3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Node { public $next = null; // define public to allow simple test case writing private $id; public function __construct($id) { $this->id = $id; } public function setNext(Node $next) { $this->next = $next; } public function action() { if ($this->next) { $this->next->action(); } echo "action for {$this->id}" . PHP_EOL; } } // make a node list manually for testing $id = 0; $root = new Node(++ $id); $root->next = new Node(++ $id); $root->next = new Node(++ $id); $root->next->next = new Node(++ $id); $root->next->next->next = new Node(++ $id); $root->next->next->next->next = new Node(++ $id); $root->next->next->next->next->next = new Node(++ $id); $root->action();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H7YpM
function name:  (null)
number of ops:  55
compiled vars:  !0 = $id, !1 = $root
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ASSIGN                                                   !0, 0
   26     1        NEW                                              $3      'Node'
          2        PRE_INC                                          ~4      !0
          3        SEND_VAL_EX                                              ~4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   27     6        NEW                                              $8      'Node'
          7        PRE_INC                                          ~9      !0
          8        SEND_VAL_EX                                              ~9
          9        DO_FCALL                                      0          
         10        ASSIGN_OBJ                                               !1, 'next'
         11        OP_DATA                                                  $8
   28    12        NEW                                              $12     'Node'
         13        PRE_INC                                          ~13     !0
         14        SEND_VAL_EX                                              ~13
         15        DO_FCALL                                      0          
         16        ASSIGN_OBJ                                               !1, 'next'
         17        OP_DATA                                                  $12
   29    18        NEW                                              $17     'Node'
         19        PRE_INC                                          ~18     !0
         20        SEND_VAL_EX                                              ~18
         21        DO_FCALL                                      0          
         22        FETCH_OBJ_W                                      $15     !1, 'next'
         23        ASSIGN_OBJ                                               $15, 'next'
         24        OP_DATA                                                  $17
   30    25        NEW                                              $23     'Node'
         26        PRE_INC                                          ~24     !0
         27        SEND_VAL_EX                                              ~24
         28        DO_FCALL                                      0          
         29        FETCH_OBJ_W                                      $20     !1, 'next'
         30        FETCH_OBJ_W                                      $21     $20, 'next'
         31        ASSIGN_OBJ                                               $21, 'next'
         32        OP_DATA                                                  $23
   31    33        NEW                                              $30     'Node'
         34        PRE_INC                                          ~31     !0
         35        SEND_VAL_EX                                              ~31
         36        DO_FCALL                                      0          
         37        FETCH_OBJ_W                                      $26     !1, 'next'
         38        FETCH_OBJ_W                                      $27     $26, 'next'
         39        FETCH_OBJ_W                                      $28     $27, 'next'
         40        ASSIGN_OBJ                                               $28, 'next'
         41        OP_DATA                                                  $30
   32    42        NEW                                              $38     'Node'
         43        PRE_INC                                          ~39     !0
         44        SEND_VAL_EX                                              ~39
         45        DO_FCALL                                      0          
         46        FETCH_OBJ_W                                      $33     !1, 'next'
         47        FETCH_OBJ_W                                      $34     $33, 'next'
         48        FETCH_OBJ_W                                      $35     $34, 'next'
         49        FETCH_OBJ_W                                      $36     $35, 'next'
         50        ASSIGN_OBJ                                               $36, 'next'
         51        OP_DATA                                                  $38
   34    52        INIT_METHOD_CALL                                         !1, 'action'
         53        DO_FCALL                                      0          
         54      > RETURN                                                   1

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

End of function __construct

Function setnext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H7YpM
function name:  setNext
number of ops:  4
compiled vars:  !0 = $next
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'next'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function setnext

Function action:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/H7YpM
function name:  action
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_OBJ_R                                      ~0      'next'
          1      > JMPZ                                                     ~0, ->5
   17     2    >   FETCH_OBJ_R                                      ~1      'next'
          3        INIT_METHOD_CALL                                         ~1, 'action'
          4        DO_FCALL                                      0          
   20     5    >   NOP                                                      
          6        FETCH_OBJ_R                                      ~3      'id'
          7        FAST_CONCAT                                      ~4      'action+for+', ~3
          8        CONCAT                                           ~5      ~4, '%0A'
          9        ECHO                                                     ~5
   21    10      > RETURN                                                   null

End of function action

End of class Node.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.26 ms | 1399 KiB | 13 Q