3v4l.org

run code in 300+ PHP versions simultaneously
<?php $low_relevancy_keys = array('guitar','bass'); $keywords_db = "bass guitar"; $pattern = '~\b' . implode('\b|\b', $low_relevancy_keys) . '\b~'; echo preg_match_all($pattern, $keywords_db); /****/ echo count(array_intersect(explode(' ', $keywords_db), $low_relevancy_keys));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nl7tO
function name:  (null)
number of ops:  25
compiled vars:  !0 = $low_relevancy_keys, !1 = $keywords_db, !2 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 'bass+guitar'
    5     2        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%5Cb%7C%5Cb'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        CONCAT                                           ~6      '%7E%5Cb', $5
          7        CONCAT                                           ~7      ~6, '%5Cb%7E'
          8        ASSIGN                                                   !2, ~7
    7     9        INIT_FCALL                                               'preg_match_all'
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $9      
         13        ECHO                                                     $9
   11    14        INIT_FCALL                                               'array_intersect'
         15        INIT_FCALL                                               'explode'
         16        SEND_VAL                                                 '+'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $10     
         19        SEND_VAR                                                 $10
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $11     
         22        COUNT                                            ~12     $11
         23        ECHO                                                     ~12
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.24 ms | 1005 KiB | 17 Q