3v4l.org

run code in 500+ PHP versions simultaneously
<?php //echo '<pre>';print_r($sArray);echo '</pre>';die; function findRepeatingStringCount($sArray) { $i = 1; $left = $sArray[0]; $right = $sArray[$i]; while ($i < count($sArray)) { if ($left == $right) { return $i; } $i++; $right = $sArray[$i]; } return 0; } $s = "pwwkew"; // string to array $sArray = str_split($s); echo '<pre>';print_r(findRepeatingStringCount($sArray));echo '</pre>';die; //abcabcbb //start index at 1 // l: a r: b // i=1 //l: a, r: c // i: 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 61) Position 1 = -2
filename:       /in/nVZ6Q
function name:  (null)
number of ops:  16
compiled vars:  !0 = $s, !1 = $sArray
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   ASSIGN                                                       !0, 'pwwkew'
   29     1        INIT_FCALL                                                   'str_split'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $3      
          4        ASSIGN                                                       !1, $3
   31     5        ECHO                                                         '%3Cpre%3E'
          6        INIT_FCALL                                                   'print_r'
          7        INIT_FCALL                                                   'findrepeatingstringcount'
          8        SEND_VAR                                                     !1
          9        DO_FCALL                                          0  $5      
         10        SEND_VAR                                                     $5
         11        DO_ICALL                                                     
         12        ECHO                                                         '%3C%2Fpre%3E'
         13      > INIT_FCALL                                                   'exit'
         14*       DO_ICALL                                                     
   43    15*     > RETURN                                                       1

Function findrepeatingstringcount:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
Branch analysis from position: 7
filename:       /in/nVZ6Q
function name:  findRepeatingStringCount
number of ops:  18
compiled vars:  !0 = $sArray, !1 = $i, !2 = $left, !3 = $right
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
   10     1        ASSIGN                                                       !1, 1
   11     2        FETCH_DIM_R                                          ~5      !0, 0
          3        ASSIGN                                                       !2, ~5
   12     4        FETCH_DIM_R                                          ~7      !0, !1
          5        ASSIGN                                                       !3, ~7
   14     6      > JMP                                                          ->13
   16     7    >   IS_EQUAL                                                     !2, !3
          8      > JMPZ                                                         ~9, ->10
   17     9    > > RETURN                                                       !1
   20    10    >   PRE_INC                                                      !1
   21    11        FETCH_DIM_R                                          ~11     !0, !1
         12        ASSIGN                                                       !3, ~11
   14    13    >   COUNT                                                ~13     !0
         14        IS_SMALLER                                                   !1, ~13
         15      > JMPNZ                                                        ~14, ->7
   24    16    > > RETURN                                                       0
   25    17*     > RETURN                                                       null

End of function findrepeatingstringcount

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.43 ms | 1381 KiB | 17 Q