3v4l.org

run code in 300+ PHP versions simultaneously
<?php $position = 48; $string = 'Urna cursus condimentum aliquam cursus [a href="/l.-da-vinci"]Leonardo da Vinci[/a]turpis class tempor suscipit egestas est praesent'; preg_match('~\[a.*?\[/a\]~', $string, $matches, PREG_OFFSET_CAPTURE); $matchStart = $matches[0][1]; $matchEnd = $matchStart+strlen($matches[0][0]); if ($position > $matchStart && $position < $matchEnd) { echo 'not allowed'; } else { echo 'allowed'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/INCh1
function name:  (null)
number of ops:  25
compiled vars:  !0 = $position, !1 = $string, !2 = $matches, !3 = $matchStart, !4 = $matchEnd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 48
    3     1        ASSIGN                                                   !1, 'Urna+cursus+condimentum+aliquam+cursus+%5Ba+href%3D%22%2Fl.-da-vinci%22%5DLeonardo+da+Vinci%5B%2Fa%5Dturpis+class+tempor+suscipit+egestas+est+praesent'
    4     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%7E%5C%5Ba.%2A%3F%5C%5B%2Fa%5C%5D%7E'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 256
          7        DO_ICALL                                                 
    6     8        FETCH_DIM_R                                      ~8      !2, 0
          9        FETCH_DIM_R                                      ~9      ~8, 1
         10        ASSIGN                                                   !3, ~9
    7    11        FETCH_DIM_R                                      ~11     !2, 0
         12        FETCH_DIM_R                                      ~12     ~11, 0
         13        STRLEN                                           ~13     ~12
         14        ADD                                              ~14     !3, ~13
         15        ASSIGN                                                   !4, ~14
    9    16        IS_SMALLER                                       ~16     !3, !0
         17      > JMPZ_EX                                          ~16     ~16, ->20
         18    >   IS_SMALLER                                       ~17     !0, !4
         19        BOOL                                             ~16     ~17
         20    > > JMPZ                                                     ~16, ->23
   10    21    >   ECHO                                                     'not+allowed'
    9    22      > JMP                                                      ->24
   12    23    >   ECHO                                                     'allowed'
   13    24    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.72 ms | 1006 KiB | 14 Q