3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myObj = (object)array('id' => 'foo', 'cat_1' => 'bar', 'cat_2' => 'baz'); $count = 0; foreach ($myObj as $key => $value) { if (strpos($key, 'cat_') === 0) { $count++; } } var_dump($count);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/ETe6T
function name:  (null)
number of ops:  19
compiled vars:  !0 = $myObj, !1 = $count, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   CAST                                          8  ~4      <array>
          1        ASSIGN                                                   !0, ~4
    5     2        ASSIGN                                                   !1, 0
    6     3      > FE_RESET_R                                       $7      !0, ->14
          4    > > FE_FETCH_R                                       ~8      $7, !2, ->14
          5    >   ASSIGN                                                   !3, ~8
    7     6        INIT_FCALL                                               'strpos'
          7        SEND_VAR                                                 !3
          8        SEND_VAL                                                 'cat_'
          9        DO_ICALL                                         $10     
         10        IS_IDENTICAL                                             $10, 0
         11      > JMPZ                                                     ~11, ->13
    8    12    >   PRE_INC                                                  !1
    6    13    > > JMP                                                      ->4
         14    >   FE_FREE                                                  $7
   12    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
206.44 ms | 1386 KiB | 17 Q