3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( "1" => array("fruit","salad","vegetable"), "2" => array("beef","meat","sausage"), "3" => array("chocolate","cake","bread") ); $sentence = "I love big sausage"; foreach($array as $key => $sub){ if(preg_grep("/" . str_replace(" ", "|", $sentence) . "/" ,$sub )){ echo "Match in ". $key . "\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/BqkW2
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $sentence, !2 = $sub, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, 'I+love+big+sausage'
   11     2      > FE_RESET_R                                       $6      !0, ->21
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->21
          4    >   ASSIGN                                                   !3, ~7
   12     5        INIT_FCALL                                               'preg_grep'
          6        INIT_FCALL                                               'str_replace'
          7        SEND_VAL                                                 '+'
          8        SEND_VAL                                                 '%7C'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $9      
         11        CONCAT                                           ~10     '%2F', $9
         12        CONCAT                                           ~11     ~10, '%2F'
         13        SEND_VAL                                                 ~11
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $12     
         16      > JMPZ                                                     $12, ->20
   13    17    >   CONCAT                                           ~13     'Match+in+', !3
         18        CONCAT                                           ~14     ~13, '%0A'
         19        ECHO                                                     ~14
   11    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $6
   15    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.71 ms | 1001 KiB | 15 Q