3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { public $parent; public function newWithParent(Item $parent) { $item = new Item(); $item->parent = $parent; return $item; } } $item = new Item(); $item = $item->newWithParent($item->newWithParent($item->newWithParent($item))); echo(json_encode($item) . "\n");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fumka
function name:  (null)
number of ops:  19
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'Item'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'newWithParent'
          4        INIT_METHOD_CALL                                         !0, 'newWithParent'
          5        INIT_METHOD_CALL                                         !0, 'newWithParent'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR_NO_REF_EX                                       $5
         11        DO_FCALL                                      0  $6      
         12        ASSIGN                                                   !0, $6
   16    13        INIT_FCALL                                               'json_encode'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $8      
         16        CONCAT                                           ~9      $8, '%0A'
         17        ECHO                                                     ~9
         18      > RETURN                                                   1

Class Item:
Function newwithparent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fumka
function name:  newWithParent
number of ops:  8
compiled vars:  !0 = $parent, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        NEW                                              $2      'Item'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $2
    9     4        ASSIGN_OBJ                                               !1, 'parent'
          5        OP_DATA                                                  !0
   10     6      > RETURN                                                   !1
   11     7*     > RETURN                                                   null

End of function newwithparent

End of class Item.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.12 ms | 1396 KiB | 15 Q