3v4l.org

run code in 500+ PHP versions simultaneously
<?php $regex = '/(foo)?(bar)?(baz)?/'; $regex = preg_replace('~.[a-z\s]*$~i', '|(?<phpstanNamedCaptureGroupLast>)$0', $regex); var_dump(preg_match($regex, '', $matches, PREG_UNMATCHED_AS_NULL)); var_dump($matches); var_dump(preg_match($regex, '', $matches)); var_dump($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6PfcK
function name:  (null)
number of ops:  28
compiled vars:  !0 = $regex, !1 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2F%28foo%29%3F%28bar%29%3F%28baz%29%3F%2F'
    4     1        FRAMELESS_ICALL_3                preg_replace        ~3      '%7E.%5Ba-z%5Cs%5D%2A%24%7Ei', '%7C%28%3F%3CphpstanNamedCaptureGroupLast%3E%29%240'
          2        OP_DATA                                                      !0
          3        ASSIGN                                                       !0, ~3
    6     4        INIT_FCALL                                                   'var_dump'
          5        INIT_FCALL                                                   'preg_match'
          6        SEND_VAR                                                     !0
          7        SEND_VAL                                                     ''
          8        SEND_REF                                                     !1
          9        SEND_VAL                                                     512
         10        DO_ICALL                                             $5      
         11        SEND_VAR                                                     $5
         12        DO_ICALL                                                     
    7    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                                     
    9    16        INIT_FCALL                                                   'var_dump'
         17        INIT_FCALL                                                   'preg_match'
         18        SEND_VAR                                                     !0
         19        SEND_VAL                                                     ''
         20        SEND_REF                                                     !1
         21        DO_ICALL                                             $8      
         22        SEND_VAR                                                     $8
         23        DO_ICALL                                                     
   10    24        INIT_FCALL                                                   'var_dump'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                                     
         27      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.88 ms | 1609 KiB | 17 Q