3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "bla.php?test1=a&test2=b&test1=c&test2=d&test1=e&test2=f&test1=g&test2=h&test1=i&test2=j"; function getToArray($url, $key) { $values = array(); list (, $query_string) = explode('?', $url, 2); foreach (explode('&', $query_string) as $param) { list($k, $v) = explode('=', $param, 2); if ($k == $key) $values[] = $v; } return $values; } print_r(getToArray($url, 'test1')); print_r(getToArray($url, 'test2'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4bD5h
function name:  (null)
number of ops:  16
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'bla.php%3Ftest1%3Da%26test2%3Db%26test1%3Dc%26test2%3Dd%26test1%3De%26test2%3Df%26test1%3Dg%26test2%3Dh%26test1%3Di%26test2%3Dj'
   15     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'gettoarray'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'test1'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   16     8        INIT_FCALL                                               'print_r'
          9        INIT_FCALL                                               'gettoarray'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'test2'
         12        DO_FCALL                                      0  $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function gettoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 32
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 32
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/4bD5h
function name:  getToArray
number of ops:  35
compiled vars:  !0 = $url, !1 = $key, !2 = $values, !3 = $query_string, !4 = $param, !5 = $k, !6 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%3F'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 2
          7        DO_ICALL                                         $8      
          8        FETCH_LIST_R                                     $9      $8, 1
          9        ASSIGN                                                   !3, $9
         10        FREE                                                     $8
    8    11        INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '%26'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $11     
         15      > FE_RESET_R                                       $12     $11, ->32
         16    > > FE_FETCH_R                                               $12, !4, ->32
    9    17    >   INIT_FCALL                                               'explode'
         18        SEND_VAL                                                 '%3D'
         19        SEND_VAR                                                 !4
         20        SEND_VAL                                                 2
         21        DO_ICALL                                         $13     
         22        FETCH_LIST_R                                     $14     $13, 0
         23        ASSIGN                                                   !5, $14
         24        FETCH_LIST_R                                     $16     $13, 1
         25        ASSIGN                                                   !6, $16
         26        FREE                                                     $13
   10    27        IS_EQUAL                                                 !5, !1
         28      > JMPZ                                                     ~18, ->31
         29    >   ASSIGN_DIM                                               !2
         30        OP_DATA                                                  !6
    8    31    > > JMP                                                      ->16
         32    >   FE_FREE                                                  $12
   12    33      > RETURN                                                   !2
   13    34*     > RETURN                                                   null

End of function gettoarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129.22 ms | 1407 KiB | 19 Q