3v4l.org

run code in 500+ PHP versions simultaneously
<?php $regular_expression = '/wp/v2/templates/(?P<parent>([^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)[\/\w%-]+)/revisions'; $current_rest_ednpoints_route_pattern = '@^' . $regular_expression . '$@i'; $request_uri = '/wp/v2/templates/my_theme_name//my_template_id/revisions'; echo 'Current regular expression: ' . $regular_expression . PHP_EOL . PHP_EOL; echo 1 === preg_match($current_rest_ednpoints_route_pattern, $request_uri) ? 'Matches "my_theme_name/my_template_id" IDs as expected.' : 'Doesn\'t match "my_theme_name/my_template_id" IDs. This is NOT expected.' ; echo PHP_EOL; $request_uri = '/wp/v2/templates/my_template_id/revisions'; echo 1 === preg_match($current_rest_ednpoints_route_pattern, $request_uri) ? 'Matches "my_template_id" IDs. This is NOT expected.' : 'Doesn\'t match "my_template_id" IDs as expected.' ; echo PHP_EOL . PHP_EOL; $fixed_regular_expression = '/wp/v2/templates/(?P<parent>([^\/:<>\*\?"\|]+\/\/?[^\/:<>\*\?"\|]+)[\/\w%-]+)/revisions'; $current_rest_ednpoints_route_pattern = '@^' . $fixed_regular_expression . '$@i'; $request_uri = '/wp/v2/templates/my_theme_name//my_template_id/revisions'; echo 'Fixed regular expression: ' . $fixed_regular_expression . PHP_EOL . PHP_EOL; echo 1 === preg_match($current_rest_ednpoints_route_pattern, $request_uri) ? 'Matches "my_theme_name/my_template_id" IDs as expected.' : 'Doesn\'t match "my_theme_name/my_template_id" IDs. This is NOT expected.' ; echo PHP_EOL; $request_uri = '/wp/v2/templates/my_template_id/revisions'; echo 1 === preg_match($current_rest_ednpoints_route_pattern, $request_uri) ? 'Matches "my_template_id" IDs. This is NOT expected.' : 'Doesn\'t match "my_template_id" IDs as expected.' ; echo PHP_EOL . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
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
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
Branch analysis from position: 49
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
Branch analysis from position: 40
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
Branch analysis from position: 23
filename:       /in/aARJS
function name:  (null)
number of ops:  53
compiled vars:  !0 = $regular_expression, !1 = $current_rest_ednpoints_route_pattern, !2 = $request_uri, !3 = $fixed_regular_expression
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2Fwp%2Fv2%2Ftemplates%2F%28%3FP%3Cparent%3E%28%5B%5E%5C%2F%3A%3C%3E%5C%2A%5C%3F%22%5C%7C%5D%2B%28%3F%3A%5C%2F%5B%5E%5C%2F%3A%3C%3E%5C%2A%5C%3F%22%5C%7C%5D%2B%29%3F%29%5B%5C%2F%5Cw%25-%5D%2B%29%2Frevisions'
    5     1        CONCAT                                               ~5      '%40%5E', !0
          2        CONCAT                                               ~6      ~5, '%24%40i'
          3        ASSIGN                                                       !1, ~6
    7     4        ASSIGN                                                       !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_theme_name%2F%2Fmy_template_id%2Frevisions'
    8     5        CONCAT                                               ~9      'Current+regular+expression%3A+', !0
          6        CONCAT                                               ~10     ~9, '%0A'
          7        CONCAT                                               ~11     ~10, '%0A'
          8        ECHO                                                         ~11
   10     9        FRAMELESS_ICALL_2                preg_match          ~12     !1, !2
         10        IS_IDENTICAL                                                 ~12, 1
         11      > JMPZ                                                         ~13, ->14
         12    >   QM_ASSIGN                                            ~14     'Matches+%22my_theme_name%2Fmy_template_id%22+IDs+as+expected.'
         13      > JMP                                                          ->15
         14    >   QM_ASSIGN                                            ~14     'Doesn%27t+match+%22my_theme_name%2Fmy_template_id%22+IDs.+This+is+NOT+expected.'
         15    >   ECHO                                                         ~14
   12    16        ECHO                                                         '%0A'
   14    17        ASSIGN                                                       !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_template_id%2Frevisions'
   15    18        FRAMELESS_ICALL_2                preg_match          ~16     !1, !2
         19        IS_IDENTICAL                                                 ~16, 1
         20      > JMPZ                                                         ~17, ->23
         21    >   QM_ASSIGN                                            ~18     'Matches+%22my_template_id%22+IDs.+This+is+NOT+expected.'
         22      > JMP                                                          ->24
         23    >   QM_ASSIGN                                            ~18     'Doesn%27t+match+%22my_template_id%22+IDs+as+expected.'
         24    >   ECHO                                                         ~18
   17    25        ECHO                                                         '%0A%0A'
   20    26        ASSIGN                                                       !3, '%2Fwp%2Fv2%2Ftemplates%2F%28%3FP%3Cparent%3E%28%5B%5E%5C%2F%3A%3C%3E%5C%2A%5C%3F%22%5C%7C%5D%2B%5C%2F%5C%2F%3F%5B%5E%5C%2F%3A%3C%3E%5C%2A%5C%3F%22%5C%7C%5D%2B%29%5B%5C%2F%5Cw%25-%5D%2B%29%2Frevisions'
   22    27        CONCAT                                               ~20     '%40%5E', !3
         28        CONCAT                                               ~21     ~20, '%24%40i'
         29        ASSIGN                                                       !1, ~21
   24    30        ASSIGN                                                       !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_theme_name%2F%2Fmy_template_id%2Frevisions'
   25    31        CONCAT                                               ~24     'Fixed+regular+expression%3A+', !3
         32        CONCAT                                               ~25     ~24, '%0A'
         33        CONCAT                                               ~26     ~25, '%0A'
         34        ECHO                                                         ~26
   27    35        FRAMELESS_ICALL_2                preg_match          ~27     !1, !2
         36        IS_IDENTICAL                                                 ~27, 1
         37      > JMPZ                                                         ~28, ->40
         38    >   QM_ASSIGN                                            ~29     'Matches+%22my_theme_name%2Fmy_template_id%22+IDs+as+expected.'
         39      > JMP                                                          ->41
         40    >   QM_ASSIGN                                            ~29     'Doesn%27t+match+%22my_theme_name%2Fmy_template_id%22+IDs.+This+is+NOT+expected.'
         41    >   ECHO                                                         ~29
   29    42        ECHO                                                         '%0A'
   31    43        ASSIGN                                                       !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_template_id%2Frevisions'
   32    44        FRAMELESS_ICALL_2                preg_match          ~31     !1, !2
         45        IS_IDENTICAL                                                 ~31, 1
         46      > JMPZ                                                         ~32, ->49
         47    >   QM_ASSIGN                                            ~33     'Matches+%22my_template_id%22+IDs.+This+is+NOT+expected.'
         48      > JMP                                                          ->50
         49    >   QM_ASSIGN                                            ~33     'Doesn%27t+match+%22my_template_id%22+IDs+as+expected.'
         50    >   ECHO                                                         ~33
   34    51        ECHO                                                         '%0A%0A'
   35    52      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
198.8 ms | 1839 KiB | 13 Q