SHARE
Facebook X Pinterest WhatsApp

Two-Dimensional Arrays In PHP

Written By
thumbnail Kevin Reichard
Kevin Reichard
Jun 22, 2000
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

thumbnail Kevin Reichard

Kevin Reichard is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
6 Best Linux Virtualization Software for 2024
What Is a Network Policy Server (NPS)? | Essential Guide
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.