3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tag = "MU"; $strings = [ 'D109 MU, worked from home today', 'Walked the dog, later took the kids to swimming. D110 MU. Went to the gym in the evening for the 9th time this month.' ]; foreach ($strings as $string) { echo "\n---\n" , preg_match("~D\K\d+(?= $tag)~", $string, $out) ? $out[0] : 'fail'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/NLBBZ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $tag, !1 = $strings, !2 = $string, !3 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'MU'
    3     1        ASSIGN                                                   !1, <array>
    8     2      > FE_RESET_R                                       $6      !1, ->20
          3    > > FE_FETCH_R                                               $6, !2, ->20
    9     4    >   ECHO                                                     '%0A---%0A'
          5        INIT_FCALL                                               'preg_match'
          6        ROPE_INIT                                     3  ~8      '%7ED%5CK%5Cd%2B%28%3F%3D+'
          7        ROPE_ADD                                      1  ~8      ~8, !0
          8        ROPE_END                                      2  ~7      ~8, '%29%7E'
          9        SEND_VAL                                                 ~7
         10        SEND_VAR                                                 !2
         11        SEND_REF                                                 !3
         12        DO_ICALL                                         $10     
         13      > JMPZ                                                     $10, ->17
         14    >   FETCH_DIM_R                                      ~11     !3, 0
         15        QM_ASSIGN                                        ~12     ~11
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~12     'fail'
         18    >   ECHO                                                     ~12
    8    19      > JMP                                                      ->3
         20    >   FE_FREE                                                  $6
   10    21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.99 ms | 1436 KiB | 14 Q