3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! function smartUrlEncode($url) { if (strpos($url, '=') === false) { return $url; } else { $startpos = strpos($url, "?"); $tmpurl = substr($url, 0, $startpos + 1); $qryStr = substr($url, $startpos + 1); $qryvalues = explode("&", $qryStr); foreach ($qryvalues as $value) { $buffer = explode("=", $value); $buffer[1] = urlencode($buffer[1]); } $finalqrystr = implode("&amp;", $qryvalues); $finalURL = $tmpurl . $finalqrystr; return $finalURL; } } echo smartUrlEncode('index.php?r=1&t=4&e=1');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P6BO0
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'smarturlencode'
          1        SEND_VAL                                                 'index.php%3Fr%3D1%26t%3D4%26e%3D1'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function smarturlencode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 46
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 46
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
filename:       /in/P6BO0
function name:  smartUrlEncode
number of ops:  56
compiled vars:  !0 = $url, !1 = $startpos, !2 = $tmpurl, !3 = $qryStr, !4 = $qryvalues, !5 = $value, !6 = $buffer, !7 = $finalqrystr, !8 = $finalURL
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3D'
          4        DO_ICALL                                         $9      
          5        TYPE_CHECK                                    4          $9
          6      > JMPZ                                                     ~10, ->9
    6     7    > > RETURN                                                   !0
          8*       JMP                                                      ->55
    8     9    >   INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 '%3F'
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !1, $11
    9    14        INIT_FCALL                                               'substr'
         15        SEND_VAR                                                 !0
         16        SEND_VAL                                                 0
         17        ADD                                              ~13     !1, 1
         18        SEND_VAL                                                 ~13
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !2, $14
   10    21        INIT_FCALL                                               'substr'
         22        SEND_VAR                                                 !0
         23        ADD                                              ~16     !1, 1
         24        SEND_VAL                                                 ~16
         25        DO_ICALL                                         $17     
         26        ASSIGN                                                   !3, $17
   11    27        INIT_FCALL                                               'explode'
         28        SEND_VAL                                                 '%26'
         29        SEND_VAR                                                 !3
         30        DO_ICALL                                         $19     
         31        ASSIGN                                                   !4, $19
   12    32      > FE_RESET_R                                       $21     !4, ->46
         33    > > FE_FETCH_R                                               $21, !5, ->46
   13    34    >   INIT_FCALL                                               'explode'
         35        SEND_VAL                                                 '%3D'
         36        SEND_VAR                                                 !5
         37        DO_ICALL                                         $22     
         38        ASSIGN                                                   !6, $22
   14    39        INIT_FCALL                                               'urlencode'
         40        FETCH_DIM_R                                      ~25     !6, 1
         41        SEND_VAL                                                 ~25
         42        DO_ICALL                                         $26     
         43        ASSIGN_DIM                                               !6, 1
         44        OP_DATA                                                  $26
   12    45      > JMP                                                      ->33
         46    >   FE_FREE                                                  $21
   16    47        INIT_FCALL                                               'implode'
         48        SEND_VAL                                                 '%26amp%3B'
         49        SEND_VAR                                                 !4
         50        DO_ICALL                                         $27     
         51        ASSIGN                                                   !7, $27
   17    52        CONCAT                                           ~29     !2, !7
         53        ASSIGN                                                   !8, ~29
   18    54      > RETURN                                                   !8
   20    55*     > RETURN                                                   null

End of function smarturlencode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.74 ms | 1394 KiB | 24 Q