3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = []; $fetch_elements = ['property', 'price']; $_SERVER['QUERY_STRING'] = 'https://www.example.com?id=safety&order=1&price=0..995&property[172]=Canasafe'; parse_str(parse_url($_SERVER['QUERY_STRING'], PHP_URL_QUERY), $elements); foreach ($elements as $k=>$e) { if (in_array($k, $fetch_elements)) { $result[$k] = $e; } } // print_r($result); echo urldecode(http_build_query($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/RGSGN
function name:  (null)
number of ops:  35
compiled vars:  !0 = $result, !1 = $fetch_elements, !2 = $elements, !3 = $e, !4 = $k
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   QM_ASSIGN                                                !0
   3     1        QM_ASSIGN                                                !1
   4     2        FETCH_W                      global              $7      '_SERVER'
         3        ASSIGN_ADD                                    0          $7, 'QUERY_STRING'
         4        OP_DATA                                                  'https%3A%2F%2Fwww.example.com%3Fid%3Dsafety%26order%3D1%26price%3D0..995%26property%5B172%5D%3DCanasafe'
   6     5        INIT_FCALL                                               'parse_str'
         6        INIT_FCALL                                               'parse_url'
         7        FETCH_R                      global              ~9      '_SERVER'
         8        FETCH_DIM_R                                      ~10     ~9, 'QUERY_STRING'
         9        SEND_VAL                                                 ~10
        10        SEND_VAL                                                 6
        11        DO_ICALL                                         $11     
        12        SEND_VAR                                                 $11
        13        SEND_REF                                                 !2
        14        DO_ICALL                                                 
   8    15      > FE_RESET_R                                       $13     !2, ->26
        16    > > FE_FETCH_R                                       ~14     $13, !3, ->26
        17    >   QM_ASSIGN                                                !4
   9    18        INIT_FCALL                                               'in_array'
        19        SEND_VAR                                                 !4
        20        SEND_VAR                                                 !1
        21        DO_ICALL                                         $16     
        22      > JMPZ                                                     $16, ->25
  10    23    >   ASSIGN_ADD                                    0          !0, !4
        24        OP_DATA                                                  !3
   8    25    > > JMP                                                      ->16
        26    >   FE_FREE                                                  $13
  15    27        INIT_FCALL                                               'urldecode'
        28        INIT_FCALL                                               'http_build_query'
        29        SEND_VAR                                                 !0
        30        DO_ICALL                                         $18     
        31        SEND_VAR                                                 $18
        32        DO_ICALL                                         $19     
        33        ASSIGN_OBJ                                               $19
        34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
36.4 ms | 463 KiB | 7 Q