3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bqs($array, $qs = false) { $parts = array(); if ($qs) { $parts[] = $qs; } foreach ($array as $key => $value) { if (is_array($value)) { foreach ($value as $value2) { $parts[] = http_build_query(array($key => $value2)); } } else { $parts[] = http_build_query(array($key => $value)); } } return join('&', $parts); } $array = array( 'order_source' => array('google', 'facebook'), 'order_medium' => array('google-text'), ); echo bqs($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j0e8s
function name:  (null)
number of ops:  6
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'bqs'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function bqs:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 6
filename:       /in/j0e8s
function name:  bqs
number of ops:  36
compiled vars:  !0 = $array, !1 = $qs, !2 = $parts, !3 = $value, !4 = $key, !5 = $value2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
    3     2        ASSIGN                                                   !2, <array>
    4     3      > JMPZ                                                     !1, ->6
    5     4    >   ASSIGN_DIM                                               !2
          5        OP_DATA                                                  !1
    7     6    > > FE_RESET_R                                       $8      !0, ->29
          7    > > FE_FETCH_R                                       ~9      $8, !3, ->29
          8    >   ASSIGN                                                   !4, ~9
    8     9        TYPE_CHECK                                  128          !3
         10      > JMPZ                                                     ~11, ->22
    9    11    > > FE_RESET_R                                       $12     !3, ->20
         12    > > FE_FETCH_R                                               $12, !5, ->20
   10    13    >   INIT_FCALL                                               'http_build_query'
         14        INIT_ARRAY                                       ~14     !5, !4
         15        SEND_VAL                                                 ~14
         16        DO_ICALL                                         $15     
         17        ASSIGN_DIM                                               !2
         18        OP_DATA                                                  $15
    9    19      > JMP                                                      ->12
         20    >   FE_FREE                                                  $12
         21      > JMP                                                      ->28
   13    22    >   INIT_FCALL                                               'http_build_query'
         23        INIT_ARRAY                                       ~17     !3, !4
         24        SEND_VAL                                                 ~17
         25        DO_ICALL                                         $18     
         26        ASSIGN_DIM                                               !2
         27        OP_DATA                                                  $18
    7    28    > > JMP                                                      ->7
         29    >   FE_FREE                                                  $8
   16    30        INIT_FCALL                                               'join'
         31        SEND_VAL                                                 '%26'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $19     
         34      > RETURN                                                   $19
   17    35*     > RETURN                                                   null

End of function bqs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.18 ms | 1403 KiB | 18 Q