3v4l.org

run code in 500+ PHP versions simultaneously
<?php $abs = "Bob Rob Sue"; $abby = "sometext Bob1:2 is Sue3:4 where Rob2:1 etc"; // escape each word for safe use in a regular expression, then join with pipes $words = str_replace(" ", "|", preg_quote($abs)); // build a regular expression that finds a boundary, a word, \d+:\d+, and a boundary $regex = '/\b(' . $words . ')(\d+:\d+)\b/'; preg_match_all($regex, $abby, $matches, PREG_SET_ORDER); print_r($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NfoKu
function name:  (null)
number of ops:  21
compiled vars:  !0 = $abs, !1 = $abby, !2 = $words, !3 = $regex, !4 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'Bob+Rob+Sue'
    4     1        ASSIGN                                                       !1, 'sometext+Bob1%3A2+is+Sue3%3A4+where+Rob2%3A1+etc'
    7     2        INIT_FCALL                                                   'preg_quote'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $7      
          5        FRAMELESS_ICALL_3                str_replace         ~8      '+', '%7C'
          6        OP_DATA                                                      $7
          7        ASSIGN                                                       !2, ~8
   10     8        CONCAT                                               ~10     '%2F%5Cb%28', !2
          9        CONCAT                                               ~11     ~10, '%29%28%5Cd%2B%3A%5Cd%2B%29%5Cb%2F'
         10        ASSIGN                                                       !3, ~11
   12    11        INIT_FCALL                                                   'preg_match_all'
         12        SEND_VAR                                                     !3
         13        SEND_VAR                                                     !1
         14        SEND_REF                                                     !4
         15        SEND_VAL                                                     2
         16        DO_ICALL                                                     
   13    17        INIT_FCALL                                                   'print_r'
         18        SEND_VAR                                                     !4
         19        DO_ICALL                                                     
         20      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
132.49 ms | 480 KiB | 10 Q