Questions about the php two-dimensional array

Source: Internet
Author: User
Question about the php two-dimensional array: I have a page. searchFangxiang. php defines a two-dimensional array: & lt ;? $ Fangxiangarray (fid101 & gt; array (fid & gt; 101, Name & gt; Emy of automation, Prof. Zhang), & nbsp; & nbsp; & question about the php two-dimensional array.
I now have a page named searchFangxiang. php that defines a two-dimensional array:
Array ("fid" => "101", "Name" => "Institute of Automation", "professor Zhang" => "),
'Fid102 '=> array ("fid" => "102", "Name" => "laboratory", "professor Li "),
'Fid103 '=> array ("fid" => "103", "Name" => "Institute of Science", "professor Wang ")););

?>

Then I reference the two-dimensional array page on my application page.



Echo "";
?>


Now the application page has an id. how can I traverse this two-dimensional array, find the group with the same fid and page id in the two-dimensional array, and then output the information of this group in the tag?
------ Solution ----------------------
Based on your data organization, no traversal is required
Just echo $ fangxiang ["fid $ id"] ['name '];
------ Solution ----------------------
Searched.

$ Fangxiang = array (
'Fid101 '=> array ("fid" => "101", "Name" => "Institute of Automation", "professor Zhang "),
'Fid102 '=> array ("fid" => "102", "Name" => "laboratory", "professor Li "),
'Fid103 '=> array ("fid" => "103", "Name" => "Institute of Science", "professor Wang" => "),
);
?>

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.