3v4l.org

run code in 500+ PHP versions simultaneously
<?php $words = array("man", "map", "php", "pop", "pnp"); $patterns = array("ma?", "p?p"); foreach ($patterns as $pattern) { $regex = '\b(' . str_replace('?', '.', $pattern) . ')\b'; $count = preg_match_all("/$regex/", implode('-', $words), $matches); echo "$pattern matched $count times on " . implode(',', $matches[1]) . ".\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 29
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 29
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/e4GbA
function name:  (null)
number of ops:  31
compiled vars:  !0 = $words, !1 = $patterns, !2 = $pattern, !3 = $regex, !4 = $count, !5 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2      > FE_RESET_R                                           $8      !1, ->29
          3    > > FE_FETCH_R                                                   $8, !2, ->29
    6     4    >   FRAMELESS_ICALL_3                str_replace         ~9      '%3F', '.'
          5        OP_DATA                                                      !2
          6        CONCAT                                               ~10     '%5Cb%28', ~9
          7        CONCAT                                               ~11     ~10, '%29%5Cb'
          8        ASSIGN                                                       !3, ~11
    7     9        INIT_FCALL                                                   'preg_match_all'
         10        ROPE_INIT                                         3  ~14     '%2F'
         11        ROPE_ADD                                          1  ~14     ~14, !3
         12        ROPE_END                                          2  ~13     ~14, '%2F'
         13        SEND_VAL                                                     ~13
         14        FRAMELESS_ICALL_2                implode             ~16     '-', !0
         15        SEND_VAL                                                     ~16
         16        SEND_REF                                                     !5
         17        DO_ICALL                                             $17     
         18        ASSIGN                                                       !4, $17
    8    19        ROPE_INIT                                         4  ~20     !2
         20        ROPE_ADD                                          1  ~20     ~20, '+matched+'
         21        ROPE_ADD                                          2  ~20     ~20, !4
         22        ROPE_END                                          3  ~19     ~20, '+times+on+'
         23        FETCH_DIM_R                                          ~22     !5, 1
         24        FRAMELESS_ICALL_2                implode             ~23     '%2C', ~22
         25        CONCAT                                               ~24     ~19, ~23
         26        CONCAT                                               ~25     ~24, '.%0A'
         27        ECHO                                                         ~25
    5    28      > JMP                                                          ->3
         29    >   FE_FREE                                                      $8
    9    30      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.48 ms | 478 KiB | 8 Q