3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ "this is a sample test" => "asample test", "sample test1 \n new line content" => "test1 new" ]; $whitechars=[' ',"\t","\r","\n"]; foreach ($tests as $input => $check) { $pattern='~'.preg_replace('~\S(?!$)\K\s*~','\s*',$check).'~'; if(preg_match($pattern,$input)){ echo "Using Pattern: ($pattern) Found: "; }else{ echo "Did Not Find: "; } /* if (strpos(preg_replace('~\s+~', '', $input), preg_replace('~\s+~', '', $check))!==false){ echo "Found: "; }else{ echo "Did Not Find: "; } */ /* if (strpos(str_replace($whitechars, '', $input), str_replace($whitechars, '', $check))!==false){ echo "Found: "; }else{ echo "Did Not Find: "; } */ echo "$check IN $input"; echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 30
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/9ELfu
function name:  (null)
number of ops:  32
compiled vars:  !0 = $tests, !1 = $whitechars, !2 = $check, !3 = $input, !4 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
    9     2      > FE_RESET_R                                       $7      !0, ->30
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->30
          4    >   ASSIGN                                                   !3, ~8
   10     5        INIT_FCALL                                               'preg_replace'
          6        SEND_VAL                                                 '%7E%5CS%28%3F%21%24%29%5CK%5Cs%2A%7E'
          7        SEND_VAL                                                 '%5Cs%2A'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $10     
         10        CONCAT                                           ~11     '%7E', $10
         11        CONCAT                                           ~12     ~11, '%7E'
         12        ASSIGN                                                   !4, ~12
   11    13        INIT_FCALL                                               'preg_match'
         14        SEND_VAR                                                 !4
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $14     
         17      > JMPZ                                                     $14, ->23
   12    18    >   ROPE_INIT                                     3  ~16     'Using+Pattern%3A+%28'
         19        ROPE_ADD                                      1  ~16     ~16, !4
         20        ROPE_END                                      2  ~15     ~16, '%29+Found%3A+'
         21        ECHO                                                     ~15
   11    22      > JMP                                                      ->24
   14    23    >   ECHO                                                     'Did+Not+Find%3A+'
   33    24    >   ROPE_INIT                                     3  ~19     !2
         25        ROPE_ADD                                      1  ~19     ~19, '+IN+'
         26        ROPE_END                                      2  ~18     ~19, !3
         27        ECHO                                                     ~18
   34    28        ECHO                                                     '%0A---%0A'
    9    29      > JMP                                                      ->3
         30    >   FE_FREE                                                  $7
   35    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.83 ms | 1012 KiB | 15 Q