3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = array('url/?page=2&filter=value', 'url/?page=2', 'url/?filter=value&page=2', 'url/?filter=value&page=2&filter2=value'); foreach($strings as $string){ echo rtrim(preg_replace('/([?&])page=[^&]*&?/', '$1', $string), '&?') . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/SupbH
function name:  (null)
number of ops:  17
compiled vars:  !0 = $strings, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    6     1      > FE_RESET_R                                       $3      !0, ->15
          2    > > FE_FETCH_R                                               $3, !1, ->15
    7     3    >   INIT_FCALL                                               'rtrim'
          4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%2F%28%5B%3F%26%5D%29page%3D%5B%5E%26%5D%2A%26%3F%2F'
          6        SEND_VAL                                                 '%241'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        SEND_VAL                                                 '%26%3F'
         11        DO_ICALL                                         $5      
         12        CONCAT                                           ~6      $5, '%0A'
         13        ECHO                                                     ~6
    6    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $3
    8    16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.81 ms | 998 KiB | 15 Q