Ask the experts to interpret a short segment of infinite classification code ,,,

Source: Internet
Author: User
Ask the experts to interpret a small segment of unlimited classification code, and unlimited classification

Foreach ($ rows as $ id => $ item)
{
If ($ item ['pid'])
{
$ Rows [$ item ['pid'] [$ item ['id'] = & $ rows [$ item ['id']; // This is the main part. can you elaborate on it?
$ T [] = $ id;
}
}


Reply to discussion (solution)

Foreach ($ rows as $ id => $ item) {// $ rows is? Array, split? Value? If ($ item ['pid']) {// if $ item ['pid '] is not false $ rows [$ item ['pid'] [$ item ['id'] = & $ rows [$ item ['id']; // This is the main part. can you elaborate on it? // Me? Are you listing array's ??? /** Array (? => Array ('id' => '? ', 'Pid' => Array ('id' => $ rows [$ item ['id']),),); /**/$ t [] = $ id ;//? $ T ?? Array append value }}

For

$rows = array(  1 => array( 'id' => 1, 'pid' => 0 ),  2 => array( 'id' => 2, 'pid' => 1 ),  3 => array( 'id' => 3, 'pid' => 2 ),  4 => array( 'id' => 4, 'pid' => 3 ),);

$ Rows [$ item ['pid '] [$ item ['id'] = & $ rows [$ item ['id'];


The premise is that the keys and IDs of the array $ rows are the same.

Foreach ($ rows as $ id => $ item) {// $ rows is? Array, split? Value? If ($ item ['pid']) {// if $ item ['pid '] is not false $ rows [$ item ['pid'] [$ item ['id'] = & $ rows [$ item ['id']; // This is the main part. can you elaborate on it? // Me? Are you listing array's ??? /** Array (? => Array ('id' => '? ', 'Pid' => Array ('id' => $ rows [$ item ['id']),),); /**/$ t [] = $ id ;//? $ T ?? Array append value }}
Why does this & symbol play the same effect as recursion?

For

$rows = array(  1 => array( 'id' => 1, 'pid' => 0 ),  2 => array( 'id' => 2, 'pid' => 1 ),  3 => array( 'id' => 3, 'pid' => 2 ),  4 => array( 'id' => 4, 'pid' => 3 ),);

$ Rows [$ item ['pid '] [$ item ['id'] = & $ rows [$ item ['id'];


The premise is that the keys and IDs of the array $ rows are the same.
The moderator often writes the following code: $ SQL = <

<Identifier
Identifier;

A custom identifier, just like a string enclosed by "" or ''. it is enclosed by an identifier.
The identifier is user-defined. you can give it a name that is close to the content.

<Identifier
Identifier;

A custom identifier, just like a string enclosed by "" or ''. it is enclosed by an identifier.
Identifiers are user-defined. you can give the identifiers a name that is close to the content.
Thank you very much, but what is the function of writing this? Generally, what is the use case? In my opinion, it is used to escape symbols on the internet. if so, is it not possible to avoid safe processing functions? However, there are few materials on the Internet.

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.