3v4l.org

run code in 300+ 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:  23
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                                               'str_replace'
          3        SEND_VAL                                                 '%5C%7C'
          4        SEND_VAL                                                 '%7C'
          5        INIT_FCALL                                               'preg_quote'
          6        INIT_FCALL                                               'implode'
          7        SEND_VAL                                                 '%7C'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                         $5      
         14        CONCAT                                           ~6      '%2F', $5
         15        CONCAT                                           ~7      ~6, '%2Fi'
         16        ASSIGN                                                   !2, ~7
    6    17        INIT_FCALL                                               'preg_match'
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $9      
         21      > RETURN                                                   $9
    7    22*     > RETURN                                                   null

End of function contains

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
232.81 ms | 1004 KiB | 18 Q