3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "&foobar&foobaz"; $toFind = 'foo'; $start = 2; $pos = 0; while($pos = strpos($str,$toFind,$pos) !== FALSE) { //echo "Starting" . $start; echo 'Found '.$toFind.' at position '.$pos."\n"; $pos++; //$start = $pos + 1; // start searching from next position. //echo "Start" . $start; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
Branch analysis from position: 5
filename:       /in/BTB7Y
function name:  (null)
number of ops:  20
compiled vars:  !0 = $str, !1 = $toFind, !2 = $start, !3 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%26foobar%26foobaz'
    3     1        ASSIGN                                                   !1, 'foo'
    4     2        ASSIGN                                                   !2, 2
    5     3        ASSIGN                                                   !3, 0
    6     4      > JMP                                                      ->11
    8     5    >   CONCAT                                           ~8      'Found+', !1
          6        CONCAT                                           ~9      ~8, '+at+position+'
          7        CONCAT                                           ~10     ~9, !3
          8        CONCAT                                           ~11     ~10, '%0A'
          9        ECHO                                                     ~11
    9    10        PRE_INC                                                  !3
    6    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16        TYPE_CHECK                                  1018  ~14     $13
         17        ASSIGN                                           ~15     !3, ~14
         18      > JMPNZ                                                    ~15, ->5
   12    19    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.39 ms | 1395 KiB | 15 Q