3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'asds asds asdas dasds', 'asdasd asds asd key1:asds', 'asdasd asdsd key2:asdsd asd key1: asdsad', 'asddfs asfasas key2: asds asd key2', // invalid 'asds key3:sdsd asdsad key1:', // invalid 'asds asds asd key1:asdsd key2: assadas asfsaf', 'asdsd aaa:bbb asds', // invalid 'sds asdsad asdsd :asdsd', // invalid ]; foreach ($strings as $string) { var_export([ $string, preg_match( '/(?!key1|key2)\b\S+: ?\S+/', $string, $m ) ? "Invalid substring: {$m[0]}" : 'No invalid substring detected' ]); echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/HREEu
function name:  (null)
number of ops:  24
compiled vars:  !0 = $strings, !1 = $string, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1      > FE_RESET_R                                       $4      !0, ->22
          2    > > FE_FETCH_R                                               $4, !1, ->22
   15     3    >   INIT_FCALL                                               'var_export'
   16     4        INIT_ARRAY                                       ~5      !1
   17     5        INIT_FCALL                                               'preg_match'
   18     6        SEND_VAL                                                 '%2F%28%3F%21key1%7Ckey2%29%5Cb%5CS%2B%3A+%3F%5CS%2B%2F'
   19     7        SEND_VAR                                                 !1
   20     8        SEND_REF                                                 !2
   17     9        DO_ICALL                                         $6      
   20    10      > JMPZ                                                     $6, ->16
   21    11    >   NOP                                                      
         12        FETCH_DIM_R                                      ~7      !2, 0
         13        FAST_CONCAT                                      ~8      'Invalid+substring%3A+', ~7
         14        QM_ASSIGN                                        ~9      ~8
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~9      'No+invalid+substring+detected'
         17    >   ADD_ARRAY_ELEMENT                                ~5      ~9
         18        SEND_VAL                                                 ~5
   15    19        DO_ICALL                                                 
   23    20        ECHO                                                     '%0A---%0A'
   14    21      > JMP                                                      ->2
         22    >   FE_FREE                                                  $4
   24    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.31 ms | 1012 KiB | 15 Q