3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $test; private $counter = 0; public function __construct() { $this->test = array('a', 'b', 'c'); } public function getBar() { return $this->test[$this->counter++]; } } $array = array(); $foo = new Foo(); foreach (range(0, 3) as $key) { $array[$foo->getBar()] = $key; } print_r($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/rEapQ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $foo, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   19     1        NEW                                              $4      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
   20     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 3
          7        DO_ICALL                                         $7      
          8      > FE_RESET_R                                       $8      $7, ->15
          9    > > FE_FETCH_R                                               $8, !2, ->15
   21    10    >   INIT_METHOD_CALL                                         !1, 'getBar'
         11        DO_FCALL                                      0  $9      
         12        ASSIGN_DIM                                               !0, $9
         13        OP_DATA                                                  !2
   20    14      > JMP                                                      ->9
         15    >   FE_FREE                                                  $8
   23    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rEapQ
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'test'
          1        OP_DATA                                                  <array>
   10     2      > RETURN                                                   null

End of function __construct

Function getbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rEapQ
function name:  getBar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   POST_INC_OBJ                                     ~1      'counter'
          1        FETCH_OBJ_R                                      ~0      'test'
          2        FETCH_DIM_R                                      ~2      ~0, ~1
          3      > RETURN                                                   ~2
   15     4*     > RETURN                                                   null

End of function getbar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.51 ms | 1396 KiB | 17 Q