3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = (object) [ 'children' => [] ]; $arr->children[] = 1; print_r($arr); class Test { public function test(){ $arr = (object) [ 'children' => [] ]; $arr->children[] = 1; return $arr; } } $o = new Test(); $o->test(); print_r( $o->test() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PJR7m
function name:  (null)
number of ops:  19
compiled vars:  !0 = $arr, !1 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   CAST                                          8  ~2      <array>
    3     1        ASSIGN                                                   !0, ~2
    6     2        FETCH_OBJ_W                                      $4      !0, 'children'
          3        ASSIGN_DIM                                               $4
          4        OP_DATA                                                  1
    8     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   20     8        NEW                                              $7      'Test'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   21    11        INIT_METHOD_CALL                                         !1, 'test'
         12        DO_FCALL                                      0          
   22    13        INIT_FCALL                                               'print_r'
         14        INIT_METHOD_CALL                                         !1, 'test'
         15        DO_FCALL                                      0  $11     
         16        SEND_VAR                                                 $11
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Test:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PJR7m
function name:  test
number of ops:  7
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   CAST                                          8  ~1      <array>
   12     1        ASSIGN                                                   !0, ~1
   15     2        FETCH_OBJ_W                                      $3      !0, 'children'
          3        ASSIGN_DIM                                               $3
          4        OP_DATA                                                  1
   16     5      > RETURN                                                   !0
   17     6*     > RETURN                                                   null

End of function test

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.72 ms | 1395 KiB | 15 Q