Tutorials

Learn web design and programming with our free video and text tutorials.

Web Designer? Design and market your own professional website with easy-to-use tools.

PHP Multi-Dimensional Arrays Tutorial

A multi-dimensional array is an array value that is set to another array within the main array, which is basicaly a list within a list.

<?php
$firstcouple = array("male" => array(
"firstname"=>"Angel",
"lastname"=>"Rico",
"age"=>124
),

"female" => array
(
"firstname"=>"Bertha",
"lastname"=>"Rico",
"age"=>123
)
);

echo $firstcouple["male"] ["firstname"];
echo " & ";
echo $firstcouple["female"] ["firstname"];
?>

The code above outputs:

Angel & Bertha