3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string='Foo, Bar, Test, X, Y, Z,'; $pos=0; $count=0; while(($pos = strpos($string, ',',$pos)) !== FALSE){ $count++; $pos++; // This ends } echo $count;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 4
Branch analysis from position: 11
Branch analysis from position: 4
filename:       /in/bg8WV
function name:  (null)
number of ops:  13
compiled vars:  !0 = $string, !1 = $pos, !2 = $count
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 'Foo%2C+Bar%2C+Test%2C+X%2C+Y%2C+Z%2C'
    3     1        ASSIGN                                                       !1, 0
    4     2        ASSIGN                                                       !2, 0
    5     3      > JMP                                                          ->6
    6     4    >   PRE_INC                                                      !2
    7     5        PRE_INC                                                      !1
    5     6    >   FRAMELESS_ICALL_3                strpos              ~8      !0, '%2C'
          7        OP_DATA                                                      !1
          8        ASSIGN                                               ~9      !1, ~8
          9        TYPE_CHECK                                      1018          ~9
         10      > JMPNZ                                                        ~10, ->4
   10    11    >   ECHO                                                         !2
         12      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.8 ms | 2280 KiB | 13 Q