3v4l.org

run code in 500+ PHP versions simultaneously
<?php $text = "Lorem Ipsum is simply one dummy text of the printing and two typesetting industry. Lorem Ipsum has been the industry's one standard dummy text ever since the three 1500s."; $keys = ['one', 'two', 'three']; $escaped = implode('|', array_map('preg_quote', $keys)); preg_match_all('#\b(' . $escaped . ')\b\s*\K.*?(?=\s*(?:$|\b(?:' . $escaped . ')\b))#', $text, $m, PREG_SET_ORDER); var_export(array_column($m, 0, 1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F9rQ9
function name:  (null)
number of ops:  27
compiled vars:  !0 = $text, !1 = $keys, !2 = $escaped, !3 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'Lorem+Ipsum+is+simply+one+dummy+text+of+the+printing+and++two+typesetting+industry.+Lorem+Ipsum+has+been+the+industry%27s+one+standard+dummy+text+ever+since+the+three+1500s.'
    5     1        ASSIGN                                                       !1, <array>
    7     2        INIT_FCALL                                                   'array_map'
          3        SEND_VAL                                                     'preg_quote'
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $6      
          6        FRAMELESS_ICALL_2                implode             ~7      '%7C', $6
          7        ASSIGN                                                       !2, ~7
    9     8        INIT_FCALL                                                   'preg_match_all'
          9        CONCAT                                               ~9      '%23%5Cb%28', !2
         10        CONCAT                                               ~10     ~9, '%29%5Cb%5Cs%2A%5CK.%2A%3F%28%3F%3D%5Cs%2A%28%3F%3A%24%7C%5Cb%28%3F%3A'
         11        CONCAT                                               ~11     ~10, !2
         12        CONCAT                                               ~12     ~11, '%29%5Cb%29%29%23'
         13        SEND_VAL                                                     ~12
         14        SEND_VAR                                                     !0
         15        SEND_REF                                                     !3
         16        SEND_VAL                                                     2
         17        DO_ICALL                                                     
   11    18        INIT_FCALL                                                   'var_export'
         19        INIT_FCALL                                                   'array_column'
         20        SEND_VAR                                                     !3
         21        SEND_VAL                                                     0
         22        SEND_VAL                                                     1
         23        DO_ICALL                                             $14     
         24        SEND_VAR                                                     $14
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.25 ms | 1735 KiB | 17 Q