3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ "Lincoln Crown", "Crown Court", "go holiday", "house fire", "John Hinton", "Hinton Jailed" ]; $output = []; $blacklist = []; foreach ($input as $string) { if (!$blacklist || !preg_match('/\b(?:' . implode('|', $blacklist) . ')\b/', $string)) { $output[] = $string; } foreach(explode(' ', $string) as $word) { $blacklist[$word] = preg_quote($word); } } var_export($blacklist); echo "\n"; var_export($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 36
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 36
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 34
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 34
Branch analysis from position: 22
Branch analysis from position: 19
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/4Aplt
function name:  (null)
number of ops:  45
compiled vars:  !0 = $input, !1 = $output, !2 = $blacklist, !3 = $string, !4 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   12     2        ASSIGN                                                   !2, <array>
   13     3      > FE_RESET_R                                       $8      !0, ->36
          4    > > FE_FETCH_R                                               $8, !3, ->36
   14     5    >   BOOL_NOT                                         ~9      !2
          6      > JMPNZ_EX                                         ~9      ~9, ->19
          7    >   INIT_FCALL                                               'preg_match'
          8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%7C'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $10     
         12        CONCAT                                           ~11     '%2F%5Cb%28%3F%3A', $10
         13        CONCAT                                           ~12     ~11, '%29%5Cb%2F'
         14        SEND_VAL                                                 ~12
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $13     
         17        BOOL_NOT                                         ~14     $13
         18        BOOL                                             ~9      ~14
         19    > > JMPZ                                                     ~9, ->22
   15    20    >   ASSIGN_DIM                                               !1
         21        OP_DATA                                                  !3
   17    22    >   INIT_FCALL                                               'explode'
         23        SEND_VAL                                                 '+'
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                         $16     
         26      > FE_RESET_R                                       $17     $16, ->34
         27    > > FE_FETCH_R                                               $17, !4, ->34
   18    28    >   INIT_FCALL                                               'preg_quote'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $19     
         31        ASSIGN_DIM                                               !2, !4
         32        OP_DATA                                                  $19
   17    33      > JMP                                                      ->27
         34    >   FE_FREE                                                  $17
   13    35      > JMP                                                      ->4
         36    >   FE_FREE                                                  $8
   21    37        INIT_FCALL                                               'var_export'
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                                 
   22    40        ECHO                                                     '%0A'
   23    41        INIT_FCALL                                               'var_export'
         42        SEND_VAR                                                 !1
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.07 ms | 1007 KiB | 18 Q