3v4l.org

run code in 300+ PHP versions simultaneously
<?php $links = array( "product.php?shopprodid=62&variantid=152" => "link" ); foreach ($links as $url => $tourl){ $parsed_url = parse_url($url); $query = isset($parsed_url['query']) ? $parsed_url['query'] : ''; parse_str($query,$parts); if ($parts["shopprodid"] && $parts["variantid"]){ echo 'RewriteCond %{QUERY_STRING} ^shopprodid='.$parts["shopprodid"].'&variantid='.$parts["variantid"].'$'."\n"; echo 'RewriteRule ^product.php$ '.$tourl.' [R=301]'; } elseif ($parts["pageid"]){ echo 'RewriteCond %{QUERY_STRING} ^pageid='.$parts["pageid"].'$'."\n"; echo 'RewriteRule ^product.php$ '.$tourl.' [R=301]'; } elseif ($parts["shopcatid"]){ echo 'RewriteCond %{QUERY_STRING} ^shopcatid='.$parts["shopcatid"].'$'."\n"; echo 'RewriteRule ^product.php$ '.$tourl.' [R=301]'; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 58
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 58
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 36
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 47
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 57
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 57
Branch analysis from position: 23
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
Branch analysis from position: 23
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
filename:       /in/nDppW
function name:  (null)
number of ops:  60
compiled vars:  !0 = $links, !1 = $tourl, !2 = $url, !3 = $parsed_url, !4 = $query, !5 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_R                                       $7      !0, ->58
          2    > > FE_FETCH_R                                       ~8      $7, !1, ->58
          3    >   ASSIGN                                                   !2, ~8
    9     4        INIT_FCALL                                               'parse_url'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !3, $10
   10     8        ISSET_ISEMPTY_DIM_OBJ                         0          !3, 'query'
          9      > JMPZ                                                     ~12, ->13
         10    >   FETCH_DIM_R                                      ~13     !3, 'query'
         11        QM_ASSIGN                                        ~14     ~13
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~14     ''
         14    >   ASSIGN                                                   !4, ~14
   12    15        INIT_FCALL                                               'parse_str'
         16        SEND_VAR                                                 !4
         17        SEND_REF                                                 !5
         18        DO_ICALL                                                 
   15    19        FETCH_DIM_R                                      ~17     !5, 'shopprodid'
         20      > JMPZ_EX                                          ~17     ~17, ->23
         21    >   FETCH_DIM_R                                      ~18     !5, 'variantid'
         22        BOOL                                             ~17     ~18
         23    > > JMPZ                                                     ~17, ->36
   16    24    >   FETCH_DIM_R                                      ~19     !5, 'shopprodid'
         25        CONCAT                                           ~20     'RewriteCond+%25%7BQUERY_STRING%7D+%5Eshopprodid%3D', ~19
         26        CONCAT                                           ~21     ~20, '%26variantid%3D'
         27        FETCH_DIM_R                                      ~22     !5, 'variantid'
         28        CONCAT                                           ~23     ~21, ~22
         29        CONCAT                                           ~24     ~23, '%24'
         30        CONCAT                                           ~25     ~24, '%0A'
         31        ECHO                                                     ~25
   17    32        CONCAT                                           ~26     'RewriteRule+%5Eproduct.php%24+', !1
         33        CONCAT                                           ~27     ~26, '+%5BR%3D301%5D'
         34        ECHO                                                     ~27
         35      > JMP                                                      ->57
   18    36    >   FETCH_DIM_R                                      ~28     !5, 'pageid'
         37      > JMPZ                                                     ~28, ->47
   19    38    >   FETCH_DIM_R                                      ~29     !5, 'pageid'
         39        CONCAT                                           ~30     'RewriteCond+%25%7BQUERY_STRING%7D+%5Epageid%3D', ~29
         40        CONCAT                                           ~31     ~30, '%24'
         41        CONCAT                                           ~32     ~31, '%0A'
         42        ECHO                                                     ~32
   20    43        CONCAT                                           ~33     'RewriteRule+%5Eproduct.php%24+', !1
         44        CONCAT                                           ~34     ~33, '+%5BR%3D301%5D'
         45        ECHO                                                     ~34
         46      > JMP                                                      ->57
   21    47    >   FETCH_DIM_R                                      ~35     !5, 'shopcatid'
         48      > JMPZ                                                     ~35, ->57
   22    49    >   FETCH_DIM_R                                      ~36     !5, 'shopcatid'
         50        CONCAT                                           ~37     'RewriteCond+%25%7BQUERY_STRING%7D+%5Eshopcatid%3D', ~36
         51        CONCAT                                           ~38     ~37, '%24'
         52        CONCAT                                           ~39     ~38, '%0A'
         53        ECHO                                                     ~39
   23    54        CONCAT                                           ~40     'RewriteRule+%5Eproduct.php%24+', !1
         55        CONCAT                                           ~41     ~40, '+%5BR%3D301%5D'
         56        ECHO                                                     ~41
    8    57    > > JMP                                                      ->2
         58    >   FE_FREE                                                  $7
   25    59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.7 ms | 1400 KiB | 17 Q