3v4l.org

run code in 300+ 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 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
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
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 61
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 61
Branch analysis from position: 59
Branch analysis from position: 61
Branch analysis from position: 29
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: 17
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
filename:       /in/aARJS
function name:  (null)
number of ops:  65
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        INIT_FCALL                                               'preg_match'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $12     
         13        IS_IDENTICAL                                             $12, 1
         14      > JMPZ                                                     ~13, ->17
         15    >   QM_ASSIGN                                        ~14     'Matches+%22my_theme_name%2Fmy_template_id%22+IDs+as+expected.'
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~14     'Doesn%27t+match+%22my_theme_name%2Fmy_template_id%22+IDs.+This+is+NOT+expected.'
         18    >   ECHO                                                     ~14
   12    19        ECHO                                                     '%0A'
   14    20        ASSIGN                                                   !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_template_id%2Frevisions'
   15    21        INIT_FCALL                                               'preg_match'
         22        SEND_VAR                                                 !1
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $16     
         25        IS_IDENTICAL                                             $16, 1
         26      > JMPZ                                                     ~17, ->29
         27    >   QM_ASSIGN                                        ~18     'Matches+%22my_template_id%22+IDs.+This+is+NOT+expected.'
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~18     'Doesn%27t+match+%22my_template_id%22+IDs+as+expected.'
         30    >   ECHO                                                     ~18
   17    31        ECHO                                                     '%0A%0A'
   20    32        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    33        CONCAT                                           ~20     '%40%5E', !3
         34        CONCAT                                           ~21     ~20, '%24%40i'
         35        ASSIGN                                                   !1, ~21
   24    36        ASSIGN                                                   !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_theme_name%2F%2Fmy_template_id%2Frevisions'
   25    37        CONCAT                                           ~24     'Fixed+regular+expression%3A+', !3
         38        CONCAT                                           ~25     ~24, '%0A'
         39        CONCAT                                           ~26     ~25, '%0A'
         40        ECHO                                                     ~26
   27    41        INIT_FCALL                                               'preg_match'
         42        SEND_VAR                                                 !1
         43        SEND_VAR                                                 !2
         44        DO_ICALL                                         $27     
         45        IS_IDENTICAL                                             $27, 1
         46      > JMPZ                                                     ~28, ->49
         47    >   QM_ASSIGN                                        ~29     'Matches+%22my_theme_name%2Fmy_template_id%22+IDs+as+expected.'
         48      > JMP                                                      ->50
         49    >   QM_ASSIGN                                        ~29     'Doesn%27t+match+%22my_theme_name%2Fmy_template_id%22+IDs.+This+is+NOT+expected.'
         50    >   ECHO                                                     ~29
   29    51        ECHO                                                     '%0A'
   31    52        ASSIGN                                                   !2, '%2Fwp%2Fv2%2Ftemplates%2Fmy_template_id%2Frevisions'
   32    53        INIT_FCALL                                               'preg_match'
         54        SEND_VAR                                                 !1
         55        SEND_VAR                                                 !2
         56        DO_ICALL                                         $31     
         57        IS_IDENTICAL                                             $31, 1
         58      > JMPZ                                                     ~32, ->61
         59    >   QM_ASSIGN                                        ~33     'Matches+%22my_template_id%22+IDs.+This+is+NOT+expected.'
         60      > JMP                                                      ->62
         61    >   QM_ASSIGN                                        ~33     'Doesn%27t+match+%22my_template_id%22+IDs+as+expected.'
         62    >   ECHO                                                     ~33
   34    63        ECHO                                                     '%0A%0A'
   35    64      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.97 ms | 1460 KiB | 14 Q