GuidesTwo-Dimensional Arrays In PHP

Two-Dimensional Arrays In PHP

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.




[ Thanks to Tre Harmon for this link. ]

This Scriptlet goes over a nice way of creating and returning a 2 dimensional array in PHP.

This Scriptlet goes over a nice way of creating and returning a 2 dimensional array in PHP…

Excerpt:



/*

Scenario:

You need to store info for 3 people and for each person you must have their:

Age, Gender, and Job Title.

*/

// Create 2 Dimensional Array.

= array(

“Bill” => array(“21″,”Male”,”Customer Service Rep”),

“Lisa” => array(“22″,”Female”,”Intranet Site Admin”),

“Tre” => array(“23″,”Male”,”Mailroom Geek”)

);

Scriptlet Url:

http://php.lansystems.com/index.php?archive=2d_arrays.inc

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories