How to deal with php code analysis

Source: Internet
Author: User
Php code analysis echo & nbsp; join ('& nbsp;-& nbsp;', & nbsp; $ _ GET), & nbsp; '& lt; br & gt; '; & nbsp; // & nbsp; ① $ dict & nbsp; = & nbsp; array (& nbsp; 'area' & nbsp php code analysis

Echo join ('-', $ _ GET ),'
'; // ①
$ Dict = array (
'Area '=> array ('mainland', 'Hong Kong and Taiwan '),
'Type' => array ('action', 'love '),
'Year' => array ('20140901', '20160901 '),
);
Foreach ($ dict as $ key => $ item ){
$ Param = $ _ GET; // ②
Foreach ($ item as $ v ){
$ Param [$ key] = $ v; // ③
$ T = http_build_query ($ param); // ④
Echo "$ v ";
}
Echo'
';
}



What is the meaning and purpose of the ① sentence?
In the second sentence, assign a value to GET with a special purpose? Is it good to use it directly?
What does ③ mean/
What does the fourth sentence mean? it seems that the third sentence has no significance ...... Thank you.
Share :';?? //? ① $ Dict? =? Array (?? 'Region '? =>? Array ('mainland ',? 'Hong Kong and Taiwan '),?? 'Ty... 'data-pics = ''>
------ Solution --------------------
Is your program saved as search. php?
------ Solution --------------------
The entire code segment is used to output the links of different combinations of the three parameters described by $ dict. There are 6 links in total. each link is based on the current request parameter and only one parameter is modified.

1. output the current request parameter $ _ GET on the page
2. modify $ param later. using $ _ GET directly causes the second start of the $ dict loop, and some parameters are modified.
3. modify one of the parameter values. for example, change "area" to "mainland" or "type" to "love ".
4. Generate the url address after the modified parameter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.