3v4l.org

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

Class test:
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/SgYsC
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_STATIC_PROP_IS                             ~1      'callCounters'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->8
    7     5    >   FETCH_STATIC_PROP_W          unknown             $4      'callCounters'
          6        ASSIGN_DIM                                               $4, !0
          7        OP_DATA                                                  0
    9     8    >   FETCH_STATIC_PROP_RW         unknown             $6      'callCounters'
          9        FETCH_DIM_RW                                     $7      $6, !0
         10        PRE_INC                                                  $7
   10    11      > RETURN                                                   null

End of function call

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.23 ms | 1400 KiB | 17 Q