3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = new class() { public $callCounters = []; public function call($index) { if (!isset($this->callCounters[$index])) { $this->callCounters[$index] = 0; } ++$this->callCounters[$index]; } }; $indexes = range('a','e'); foreach($indexes as $index) { for($i = 0; $i <= 2; ++$i) { $x->call($index); } } var_dump($x->callCounters);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 13
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 13
Branch analysis from position: 19
Branch analysis from position: 13
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/3sA0F
function name:  (null)
number of ops:  26
compiled vars:  !0 = $x, !1 = $indexes, !2 = $index, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_ANON_CLASS                               <ptr>   
          1        NEW                                              $5      $4
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
   13     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 'a'
          6        SEND_VAL                                                 'e'
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !1, $8
   15     9      > FE_RESET_R                                       $10     !1, ->20
         10    > > FE_FETCH_R                                               $10, !2, ->20
   16    11    >   ASSIGN                                                   !3, 0
         12      > JMP                                                      ->17
   17    13    >   INIT_METHOD_CALL                                         !0, 'call'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0          
   16    16        PRE_INC                                                  !3
         17    >   IS_SMALLER_OR_EQUAL                                      !3, 2
         18      > JMPNZ                                                    ~14, ->13
   15    19    > > JMP                                                      ->10
         20    >   FE_FREE                                                  $10
   21    21        INIT_FCALL                                               'var_dump'
         22        FETCH_OBJ_R                                      ~15     !0, 'callCounters'
         23        SEND_VAL                                                 ~15
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class class@anonymous:
Function call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/3sA0F
function name:  call
number of ops:  12
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_OBJ_IS                                     ~1      'callCounters'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->8
    7     5    >   FETCH_OBJ_W                                      $4      'callCounters'
          6        ASSIGN_DIM                                               $4, !0
          7        OP_DATA                                                  0
    9     8    >   FETCH_OBJ_RW                                     $6      'callCounters'
          9        FETCH_DIM_RW                                     $7      $6, !0
         10        PRE_INC                                                  $7
   10    11      > RETURN                                                   null

End of function call

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.52 ms | 1400 KiB | 17 Q