3v4l.org

run code in 300+ 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:  30
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                                               'implode'
          3        SEND_VAL                                                 '%7C'
          4        INIT_FCALL                                               'array_map'
          5        SEND_VAL                                                 'preg_quote'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
    9    11        INIT_FCALL                                               'preg_match_all'
         12        CONCAT                                           ~9      '%23%5Cb%28', !2
         13        CONCAT                                           ~10     ~9, '%29%5Cb%5Cs%2A%5CK.%2A%3F%28%3F%3D%5Cs%2A%28%3F%3A%24%7C%5Cb%28%3F%3A'
         14        CONCAT                                           ~11     ~10, !2
         15        CONCAT                                           ~12     ~11, '%29%5Cb%29%29%23'
         16        SEND_VAL                                                 ~12
         17        SEND_VAR                                                 !0
         18        SEND_REF                                                 !3
         19        SEND_VAL                                                 2
         20        DO_ICALL                                                 
   11    21        INIT_FCALL                                               'var_export'
         22        INIT_FCALL                                               'array_column'
         23        SEND_VAR                                                 !3
         24        SEND_VAL                                                 0
         25        SEND_VAL                                                 1
         26        DO_ICALL                                         $14     
         27        SEND_VAR                                                 $14
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.41 ms | 1015 KiB | 18 Q