3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $items = array(1,2,3); function getItems() { return $this->items; } } $foo = new Foo(); foreach($foo->getItems() as &$item) { echo $item, PHP_EOL; $item = '-1'; } var_dump($foo->getItems());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 126) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/BZ6EZ
function name:  (null)
number of ops:  19
compiled vars:  !0 = $foo, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        INIT_METHOD_CALL                                         !0, 'getItems'
          4        DO_FCALL                                      0  $5      
          5        SEPARATE                                         $5      $5
          6      > FE_RESET_RW                                      $6      $5, ->12
          7    > > FE_FETCH_RW                                              $6, !1, ->12
   13     8    >   ECHO                                                     !1
          9        ECHO                                                     '%0A'
   14    10        ASSIGN                                                   !1, '-1'
   12    11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $6
   17    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !0, 'getItems'
         15        DO_FCALL                                      0  $8      
         16        SEND_VAR                                                 $8
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class Foo:
Function getitems:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BZ6EZ
function name:  getItems
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_R                                      ~0      'items'
          1      > RETURN                                                   ~0
    7     2*     > RETURN                                                   null

End of function getitems

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.51 ms | 1387 KiB | 15 Q