3v4l.org

run code in 500+ PHP versions simultaneously
<?php function contains(string $haystack, array $needles){ $regex = '/' . str_replace('\|', '|', preg_quote(implode('|', $needles))) . '/i'; return preg_match($regex, $haystack); } $string = 'My nAmE is Tom.'; $array = array("name","tom"); if(contains($string,$array)) { echo 'doing action'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/lY6qo
function name:  (null)
number of ops:  9
compiled vars:  !0 = $string, !1 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                       !0, 'My+nAmE+is+Tom.'
   10     1        ASSIGN                                                       !1, <array>
   12     2        INIT_FCALL                                                   'contains'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_FCALL                                          0  $4      
          6      > JMPZ                                                         $4, ->8
   14     7    >   ECHO                                                         'doing+action'
   15     8    > > RETURN                                                       1

Function contains:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lY6qo
function name:  contains
number of ops:  14
compiled vars:  !0 = $haystack, !1 = $needles, !2 = $regex
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        INIT_FCALL                                                   'preg_quote'
          3        FRAMELESS_ICALL_2                implode             ~3      '%7C', !1
          4        SEND_VAL                                                     ~3
          5        DO_ICALL                                             $4      
          6        FRAMELESS_ICALL_3                str_replace         ~5      '%5C%7C', '%7C'
          7        OP_DATA                                                      $4
          8        CONCAT                                               ~6      '%2F', ~5
          9        CONCAT                                               ~7      ~6, '%2Fi'
         10        ASSIGN                                                       !2, ~7
    6    11        FRAMELESS_ICALL_2                preg_match          ~9      !2, !0
         12      > RETURN                                                       ~9
    7    13*     > RETURN                                                       null

End of function contains

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
178.01 ms | 3340 KiB | 15 Q