3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "lorem ipsum <foo=42> dolor sit <bar=[17]> amet consectepture <foo=[37]> adipisicing elit <bar=19> sed do eiusmod"; $re = '/(?J)<%{name}=(?|(?<value>\\d+)|\\[(?<value>\\d+)\\])>/'; foreach (array("foo", "bar") as $name) { echo $name, ": "; if (false !== preg_match(str_replace("%{name}", $name, $re), $string, $m)) { var_dump($m['value']); } else { echo "<FALSE>\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/sEJXk
function name:  (null)
number of ops:  27
compiled vars:  !0 = $string, !1 = $re, !2 = $name, !3 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'lorem+ipsum+%3Cfoo%3D42%3E+dolor+sit+%3Cbar%3D%5B17%5D%3E+amet+consectepture+%3Cfoo%3D%5B37%5D%3E+adipisicing+elit+%3Cbar%3D19%3E+sed+do+eiusmod'
    4     1        ASSIGN                                                   !1, '%2F%28%3FJ%29%3C%25%7Bname%7D%3D%28%3F%7C%28%3F%3Cvalue%3E%5Cd%2B%29%7C%5C%5B%28%3F%3Cvalue%3E%5Cd%2B%29%5C%5D%29%3E%2F'
    6     2      > FE_RESET_R                                       $6      <array>, ->25
          3    > > FE_FETCH_R                                               $6, !2, ->25
    7     4    >   ECHO                                                     !2
          5        ECHO                                                     '%3A+'
    8     6        INIT_FCALL                                               'preg_match'
          7        INIT_FCALL                                               'str_replace'
          8        SEND_VAL                                                 '%25%7Bname%7D'
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        SEND_VAR                                                 !0
         14        SEND_REF                                                 !3
         15        DO_ICALL                                         $8      
         16        TYPE_CHECK                                  1018          $8
         17      > JMPZ                                                     ~9, ->23
    9    18    >   INIT_FCALL                                               'var_dump'
         19        FETCH_DIM_R                                      ~10     !3, 'value'
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                                 
         22      > JMP                                                      ->24
   12    23    >   ECHO                                                     '%3CFALSE%3E%0A'
    6    24    > > JMP                                                      ->3
         25    >   FE_FREE                                                  $6
   14    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.4 ms | 1388 KiB | 19 Q