3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { public int $i; } $array = [new x, new x, new x]; $array[0]->i = 0; $array[1]->i = 1; $array[2]->i = 2; function foo(array $array) { $array[] = new x; $array[2]->i = 12; $array[3]->i = 3; print count($array)." elements in foo\n"; } print count($array)." elements before foo\n"; foo($array); print count($array)." elements after foo\n"; print_r($array[2]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/neuVu
function name:  (null)
number of ops:  33
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $1      'x'
          1        DO_FCALL                                          0          
          2        INIT_ARRAY                                           ~3      $1
          3        NEW                                                  $4      'x'
          4        DO_FCALL                                          0          
          5        ADD_ARRAY_ELEMENT                                    ~3      $4
          6        NEW                                                  $6      'x'
          7        DO_FCALL                                          0          
          8        ADD_ARRAY_ELEMENT                                    ~3      $6
          9        ASSIGN                                                       !0, ~3
    8    10        FETCH_DIM_W                                          $9      !0, 0
         11        ASSIGN_OBJ                                                   $9, 'i'
         12        OP_DATA                                                      0
    9    13        FETCH_DIM_W                                          $11     !0, 1
         14        ASSIGN_OBJ                                                   $11, 'i'
         15        OP_DATA                                                      1
   10    16        FETCH_DIM_W                                          $13     !0, 2
         17        ASSIGN_OBJ                                                   $13, 'i'
         18        OP_DATA                                                      2
   20    19        COUNT                                                ~15     !0
         20        CONCAT                                               ~16     ~15, '+elements+before+foo%0A'
         21        ECHO                                                         ~16
   21    22        INIT_FCALL                                                   'foo'
         23        SEND_VAR                                                     !0
         24        DO_FCALL                                          0          
   22    25        COUNT                                                ~18     !0
         26        CONCAT                                               ~19     ~18, '+elements+after+foo%0A'
         27        ECHO                                                         ~19
   23    28        INIT_FCALL                                                   'print_r'
         29        FETCH_DIM_R                                          ~20     !0, 2
         30        SEND_VAL                                                     ~20
         31        DO_ICALL                                                     
         32      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/neuVu
function name:  foo
number of ops:  15
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        NEW                                                  $2      'x'
          2        DO_FCALL                                          0          
          3        ASSIGN_DIM                                                   !0
          4        OP_DATA                                                      $2
   15     5        FETCH_DIM_W                                          $4      !0, 2
          6        ASSIGN_OBJ                                                   $4, 'i'
          7        OP_DATA                                                      12
   16     8        FETCH_DIM_W                                          $6      !0, 3
          9        ASSIGN_OBJ                                                   $6, 'i'
         10        OP_DATA                                                      3
   17    11        COUNT                                                ~8      !0
         12        CONCAT                                               ~9      ~8, '+elements+in+foo%0A'
         13        ECHO                                                         ~9
   18    14      > RETURN                                                       null

End of function foo

Class X: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.54 ms | 3410 KiB | 15 Q