3v4l.org

run code in 300+ PHP versions simultaneously
<?php preg_match("#[\w()-]#", 'some text'); // ok preg_match("#[-\w()]#", 'some text'); // ok preg_match("#[\w-()]#", 'some text'); // NOPE! preg_match("#[\w(-)]#", 'some text'); // ok
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dRG8U
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'preg_match'
          1        SEND_VAL                                                 '%23%5B%5Cw%28%29-%5D%23'
          2        SEND_VAL                                                 'some+text'
          3        DO_ICALL                                                 
    4     4        INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%23%5B-%5Cw%28%29%5D%23'
          6        SEND_VAL                                                 'some+text'
          7        DO_ICALL                                                 
    5     8        INIT_FCALL                                               'preg_match'
          9        SEND_VAL                                                 '%23%5B%5Cw-%28%29%5D%23'
         10        SEND_VAL                                                 'some+text'
         11        DO_ICALL                                                 
    6    12        INIT_FCALL                                               'preg_match'
         13        SEND_VAL                                                 '%23%5B%5Cw%28-%29%5D%23'
         14        SEND_VAL                                                 'some+text'
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.1 ms | 997 KiB | 14 Q