3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<TXT /something/ and /something?foo=bar are ok, but /another/something/ is not. Ah, /something is ok without trailing slash is ok as well. TXT; $r = '~(?:\s|^)(/something/?(?:\?[^\s]+)?)~'; preg_match_all($r, $str, $m); print_r($m[1]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r2GDn
function name:  (null)
number of ops:  12
compiled vars:  !0 = $str, !1 = $r, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2Fsomething%2F+and+%2Fsomething%3Ffoo%3Dbar%0Aare+ok%2C+but+%2Fanother%2Fsomething%2F+is+not.%0AAh%2C+%2Fsomething+is+ok+without+trailing%0Aslash+is+ok+as+well.'
   10     1        ASSIGN                                                   !1, '%7E%28%3F%3A%5Cs%7C%5E%29%28%2Fsomething%2F%3F%28%3F%3A%5C%3F%5B%5E%5Cs%5D%2B%29%3F%29%7E'
   12     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   14     7        INIT_FCALL                                               'print_r'
          8        FETCH_DIM_R                                      ~6      !2, 1
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
285.45 ms | 1005 KiB | 15 Q