3v4l.org

run code in 300+ PHP versions simultaneously
<?php $forbidden_words = array("word1", "word2", "word3"); $string = "a very long text .... word"; if(preg_match('/\b(' . implode('|', array_map('preg_quote', $forbidden_words)) . ')\b/', $string)) { echo 'have forbidden word(s)'; } else { echo 'no forbidden words'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y4gTJ
function name:  (null)
number of ops:  21
compiled vars:  !0 = $forbidden_words, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 'a+very+long+text+....+word'
    4     2        INIT_FCALL                                               'preg_match'
          3        INIT_FCALL                                               'implode'
          4        SEND_VAL                                                 '%7C'
          5        INIT_FCALL                                               'array_map'
          6        SEND_VAL                                                 'preg_quote'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
         11        CONCAT                                           ~6      '%2F%5Cb%28', $5
         12        CONCAT                                           ~7      ~6, '%29%5Cb%2F'
         13        SEND_VAL                                                 ~7
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16      > JMPZ                                                     $8, ->19
    5    17    >   ECHO                                                     'have+forbidden+word%28s%29'
    4    18      > JMP                                                      ->20
    7    19    >   ECHO                                                     'no+forbidden+words'
    8    20    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.38 ms | 1003 KiB | 16 Q