3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "PHP [gallery-1]. [gallery-2]"; if (preg_match_all("/\b\[gallery-\b/i", $text, $matches, PREG_OFFSET_CAPTURE)) { print_r($matches); $position = $matches[0][0][1]; } else { echo "A match was not found."; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8PQm3
function name:  (null)
number of ops:  18
compiled vars:  !0 = $text, !1 = $matches, !2 = $position
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'PHP+%5Bgallery-1%5D.+%5Bgallery-2%5D'
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%5Cb%5C%5Bgallery-%5Cb%2Fi'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        SEND_VAL                                                 256
          6        DO_ICALL                                         $4      
          7      > JMPZ                                                     $4, ->16
    6     8    >   INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
    8    11        FETCH_DIM_R                                      ~6      !1, 0
         12        FETCH_DIM_R                                      ~7      ~6, 0
         13        FETCH_DIM_R                                      ~8      ~7, 1
         14        ASSIGN                                                   !2, ~8
         15      > JMP                                                      ->17
   11    16    >   ECHO                                                     'A+match+was+not+found.'
   12    17    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.64 ms | 1395 KiB | 17 Q