3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-type: text/html; charset=utf-8'); echo '<br />百度关键词URL编码转换示例:<br />'; $urlBaidu = 'http://www.baidu.com/s?wd=%D6%D0%CE%C4'; $arrParse = parse_url($urlBaidu); var_dump($arrParse); parse_str($arrParse ['query'],$output); echo '乱码:' . $output['wd'] . '<br />'; //将gb2312编码转换成utf-8编码 $strUTF8 = mb_convert_encoding($output['wd'], 'utf-8', 'gb2312'); echo '可读码:' . $strUTF8 . '<br />'; echo '<br />谷歌关键词URL编码转换示例:<br />'; $urlGoogle = 'http://www.google.cn/search?hl=zh-CN&source=hp&q=%E4%B8%AD%E6%96%87&aq=f&oq='; $arrParse = parse_url($urlGoogle); var_dump($arrParse); parse_str($arrParse ['query'],$output); //谷歌关键词URL编码是utf-8,不用再作转换 echo '可读码:' . $output['q'] . '<br />';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BFTS4
function name:  (null)
number of ops:  50
compiled vars:  !0 = $urlBaidu, !1 = $arrParse, !2 = $output, !3 = $strUTF8, !4 = $urlGoogle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-type%3A+text%2Fhtml%3B+charset%3Dutf-8'
          2        DO_ICALL                                                 
    5     3        ECHO                                                     '%3Cbr+%2F%3E%E7%99%BE%E5%BA%A6%E5%85%B3%E9%94%AE%E8%AF%8DURL%E7%BC%96%E7%A0%81%E8%BD%AC%E6%8D%A2%E7%A4%BA%E4%BE%8B%EF%BC%9A%3Cbr+%2F%3E'
    7     4        ASSIGN                                                   !0, 'http%3A%2F%2Fwww.baidu.com%2Fs%3Fwd%3D%25D6%25D0%25CE%25C4'
    9     5        INIT_FCALL                                               'parse_url'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
   10     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   11    12        INIT_FCALL                                               'parse_str'
         13        FETCH_DIM_R                                      ~10     !1, 'query'
         14        SEND_VAL                                                 ~10
         15        SEND_REF                                                 !2
         16        DO_ICALL                                                 
   13    17        FETCH_DIM_R                                      ~12     !2, 'wd'
         18        CONCAT                                           ~13     '%E4%B9%B1%E7%A0%81%EF%BC%9A', ~12
         19        CONCAT                                           ~14     ~13, '%3Cbr+%2F%3E'
         20        ECHO                                                     ~14
   16    21        INIT_FCALL                                               'mb_convert_encoding'
         22        FETCH_DIM_R                                      ~15     !2, 'wd'
         23        SEND_VAL                                                 ~15
         24        SEND_VAL                                                 'utf-8'
         25        SEND_VAL                                                 'gb2312'
         26        DO_ICALL                                         $16     
         27        ASSIGN                                                   !3, $16
   18    28        CONCAT                                           ~18     '%E5%8F%AF%E8%AF%BB%E7%A0%81%EF%BC%9A', !3
         29        CONCAT                                           ~19     ~18, '%3Cbr+%2F%3E'
         30        ECHO                                                     ~19
   20    31        ECHO                                                     '%3Cbr+%2F%3E%E8%B0%B7%E6%AD%8C%E5%85%B3%E9%94%AE%E8%AF%8DURL%E7%BC%96%E7%A0%81%E8%BD%AC%E6%8D%A2%E7%A4%BA%E4%BE%8B%EF%BC%9A%3Cbr+%2F%3E'
   22    32        ASSIGN                                                   !4, 'http%3A%2F%2Fwww.google.cn%2Fsearch%3Fhl%3Dzh-CN%26source%3Dhp%26q%3D%25E4%25B8%25AD%25E6%2596%2587%26aq%3Df%26oq%3D'
   24    33        INIT_FCALL                                               'parse_url'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                         $21     
         36        ASSIGN                                                   !1, $21
   25    37        INIT_FCALL                                               'var_dump'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
   26    40        INIT_FCALL                                               'parse_str'
         41        FETCH_DIM_R                                      ~24     !1, 'query'
         42        SEND_VAL                                                 ~24
         43        SEND_REF                                                 !2
         44        DO_ICALL                                                 
   29    45        FETCH_DIM_R                                      ~26     !2, 'q'
         46        CONCAT                                           ~27     '%E5%8F%AF%E8%AF%BB%E7%A0%81%EF%BC%9A', ~26
         47        CONCAT                                           ~28     ~27, '%3Cbr+%2F%3E'
         48        ECHO                                                     ~28
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.01 ms | 1400 KiB | 23 Q