3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &test($v) { $o = new stdClass; $o->test = $v; return $o; } $a = array(); foreach(range(1, 2) as $v) { $o = test($v); array_push($a, $o); var_dump($a); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/AoYnG
function name:  (null)
number of ops:  21
compiled vars:  !0 = $a, !1 = $v, !2 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 2
          4        DO_ICALL                                         $4      
          5      > FE_RESET_R                                       $5      $4, ->19
          6    > > FE_FETCH_R                                               $5, !1, ->19
   12     7    >   INIT_FCALL                                               'test'
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $6      
         10        ASSIGN                                                   !2, $6
   13    11        INIT_FCALL                                               'array_push'
         12        SEND_REF                                                 !0
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
   14    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   11    18      > JMP                                                      ->6
         19    >   FE_FREE                                                  $5
   15    20      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/AoYnG
function name:  test
number of ops:  8
compiled vars:  !0 = $v, !1 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $2      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $2
    5     4        ASSIGN_OBJ                                               !1, 'test'
          5        OP_DATA                                                  !0
    6     6      > RETURN_BY_REF                                            !1
    7     7*     > RETURN_BY_REF                                            null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.82 ms | 1403 KiB | 20 Q