3v4l.org

run code in 300+ PHP versions simultaneously
<?php $keywordRegex = '(?<key>-?mock)'; $valueRegex = '"(?<quoted>(?:[^"]|\\\")*)"|(?<unquoted>[^"\s]+)'; $regex = "/(?<=^|\\s){$keywordRegex}:\\s*{$valueRegex}/"; echo $regex, "\n\n"; $inputs = array( 'mock:"foo"', 'mock:bar\"foo', 'mock:""foo""' ); foreach ( $inputs as $term ) { $matches = null; echo $term, "\n"; preg_match( $regex, $term, $matches ); var_dump( $matches ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 25
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/KrQSR
function name:  (null)
number of ops:  27
compiled vars:  !0 = $keywordRegex, !1 = $valueRegex, !2 = $regex, !3 = $inputs, !4 = $term, !5 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%28%3F%3Ckey%3E-%3Fmock%29'
    4     1        ASSIGN                                                   !1, '%22%28%3F%3Cquoted%3E%28%3F%3A%5B%5E%22%5D%7C%5C%5C%22%29%2A%29%22%7C%28%3F%3Cunquoted%3E%5B%5E%22%5Cs%5D%2B%29'
    6     2        ROPE_INIT                                     5  ~9      '%2F%28%3F%3C%3D%5E%7C%5Cs%29'
          3        ROPE_ADD                                      1  ~9      ~9, !0
          4        ROPE_ADD                                      2  ~9      ~9, '%3A%5Cs%2A'
          5        ROPE_ADD                                      3  ~9      ~9, !1
          6        ROPE_END                                      4  ~8      ~9, '%2F'
          7        ASSIGN                                                   !2, ~8
    8     8        ECHO                                                     !2
          9        ECHO                                                     '%0A%0A'
   10    10        ASSIGN                                                   !3, <array>
   11    11      > FE_RESET_R                                       $14     !3, ->25
         12    > > FE_FETCH_R                                               $14, !4, ->25
   12    13    >   ASSIGN                                                   !5, null
   13    14        ECHO                                                     !4
         15        ECHO                                                     '%0A'
   14    16        INIT_FCALL                                               'preg_match'
         17        SEND_VAR                                                 !2
         18        SEND_VAR                                                 !4
         19        SEND_REF                                                 !5
         20        DO_ICALL                                                 
   15    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                                 
   11    24      > JMP                                                      ->12
         25    >   FE_FREE                                                  $14
   16    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.17 ms | 1396 KiB | 17 Q