3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sentence = "This is a red apple"; $words = array('red','apple'); $ch = implode("|",$words); $pattern = "/($ch)/"; if(preg_match_all($pattern, $sentence,$m)) { echo "yes \n"; print_r($m); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/qd046
function name:  (null)
number of ops:  22
compiled vars:  !0 = $sentence, !1 = $words, !2 = $ch, !3 = $pattern, !4 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+is+a+red+apple'
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%7C'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
    6     7        ROPE_INIT                                     3  ~10     '%2F%28'
          8        ROPE_ADD                                      1  ~10     ~10, !2
          9        ROPE_END                                      2  ~9      ~10, '%29%2F'
         10        ASSIGN                                                   !3, ~9
    7    11        INIT_FCALL                                               'preg_match_all'
         12        SEND_VAR                                                 !3
         13        SEND_VAR                                                 !0
         14        SEND_REF                                                 !4
         15        DO_ICALL                                         $13     
         16      > JMPZ                                                     $13, ->21
    9    17    >   ECHO                                                     'yes+%0A'
   10    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
   11    21    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.25 ms | 1395 KiB | 19 Q