3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string='Foo, Bar, Test, X, Y, Z,'; $needle = array("Bar", "Foo"); $pos=0; $count=0; while(($pos = strpos($string, $needle ,$pos)) !== FALSE){ $count++; $pos++; // This en } echo $count;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 5
Branch analysis from position: 15
Branch analysis from position: 5
filename:       /in/U31km
function name:  (null)
number of ops:  17
compiled vars:  !0 = $string, !1 = $needle, !2 = $pos, !3 = $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, <array>
    4     2        ASSIGN                                                   !2, 0
    5     3        ASSIGN                                                   !3, 0
    6     4      > JMP                                                      ->7
    7     5    >   PRE_INC                                                  !3
    8     6        PRE_INC                                                  !2
    6     7    >   INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12        ASSIGN                                           ~11     !2, $10
         13        TYPE_CHECK                                  1018          ~11
         14      > JMPNZ                                                    ~12, ->5
   11    15    >   ECHO                                                     !3
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.48 ms | 1395 KiB | 15 Q