3v4l.org

run code in 300+ PHP versions simultaneously
<?php function addQuery($url,array $query) { $cache=parse_url($url,PHP_URL_QUERY); if(empty($cache)) return $url."?".http_build_query($query); else return $url."&".http_build_query($query); } $test=array("http://example.com/page/","http://example.com/page","http://example.com/?p=page"); print_r(array_map(function($v){ return addQuery($v,array("myquery"=>"string")); },$test));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vMCKC
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FvMCKC%3A9%240'
   11     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function addquery:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vMCKC
function name:  addQuery
number of ops:  23
compiled vars:  !0 = $url, !1 = $query, !2 = $cache
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'parse_url'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 6
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
    5     7        ISSET_ISEMPTY_CV                                         !2
          8      > JMPZ                                                     ~5, ->16
          9    >   CONCAT                                           ~6      !0, '%3F'
         10        INIT_FCALL                                               'http_build_query'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        CONCAT                                           ~8      ~6, $7
         14      > RETURN                                                   ~8
         15*       JMP                                                      ->22
    6    16    >   CONCAT                                           ~9      !0, '%26'
         17        INIT_FCALL                                               'http_build_query'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $10     
         20        CONCAT                                           ~11     ~9, $10
         21      > RETURN                                                   ~11
    7    22*     > RETURN                                                   null

End of function addquery

Function %00%7Bclosure%7D%2Fin%2FvMCKC%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vMCKC
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'addquery'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
   11     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FvMCKC%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
276.92 ms | 1403 KiB | 23 Q