Please read a small segment of unlimited classification code,

Source: Internet
Author: User
Explain a short segment of infinite classification code, foreach & nbsp; ($ rows & nbsp; as & nbsp; $ id & nbsp ;=& gt; & nbsp; $ item) & nbsp; {if & nbsp; ($ item ['pid ']) Ask the experts to interpret a short segment of infinite classification code ,,,
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;
}
} Share an unlimited category :? $ Item )??? {If? ($ Item ['pid ']) ??? {$ Rows [$ item ['pid'] [$ I... 'data-pics = ''>
------ Solution --------------------
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.
------ Solution --------------------
<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.

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.