3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = ["AD-2018-34567-234","10256","1234567890-rfwet043-123455-cd1234-sdf"]; $str2 = ["cd 34567","cd 10256","4edgs-cd12340e-3ed"]; foreach($str1 as $key => $str){ $find = $str2[$key]; $l = strlen($find); $match = false; for($i=0; $i<=($l-5);$i++){ // loop the find string //echo $str . " " . substr($find,$i, 5) . "\n"; // debug if(strpos($str, substr($find,$i, 5)) !== false) { // take five characters at the time and stros them $match = true; break; } } if($match){ echo "match\n"; }else{ echo "no match\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 34
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 34
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 12
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 12
Branch analysis from position: 29
Branch analysis from position: 12
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/unp0D
function name:  (null)
number of ops:  36
compiled vars:  !0 = $str1, !1 = $str2, !2 = $str, !3 = $key, !4 = $find, !5 = $l, !6 = $match, !7 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2      > FE_RESET_R                                       $10     !0, ->34
          3    > > FE_FETCH_R                                       ~11     $10, !2, ->34
          4    >   ASSIGN                                                   !3, ~11
    7     5        FETCH_DIM_R                                      ~13     !1, !3
          6        ASSIGN                                                   !4, ~13
    8     7        STRLEN                                           ~15     !4
          8        ASSIGN                                                   !5, ~15
    9     9        ASSIGN                                                   !6, <false>
   10    10        ASSIGN                                                   !7, 0
         11      > JMP                                                      ->26
   12    12    >   INIT_FCALL                                               'strpos'
         13        SEND_VAR                                                 !2
         14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !4
         16        SEND_VAR                                                 !7
         17        SEND_VAL                                                 5
         18        DO_ICALL                                         $19     
         19        SEND_VAR                                                 $19
         20        DO_ICALL                                         $20     
         21        TYPE_CHECK                                  1018          $20
         22      > JMPZ                                                     ~21, ->25
   13    23    >   ASSIGN                                                   !6, <true>
   14    24      > JMP                                                      ->29
   10    25    >   PRE_INC                                                  !7
         26    >   SUB                                              ~24     !5, 5
         27        IS_SMALLER_OR_EQUAL                                      !7, ~24
         28      > JMPNZ                                                    ~25, ->12
   17    29    > > JMPZ                                                     !6, ->32
   18    30    >   ECHO                                                     'match%0A'
   17    31      > JMP                                                      ->33
   20    32    >   ECHO                                                     'no+match%0A'
    6    33    > > JMP                                                      ->3
         34    >   FE_FREE                                                  $10
   22    35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.57 ms | 1008 KiB | 15 Q