Multidimensional Arrays |
|
March 21, 2008 |
Multidimensional arrays are basically arrays within arrays. So, let’s make one.
//Our first array is going to be for dairy products:
$dairy = array(1 => second array is going to be for animals:
$animals = array(1 =>
//Now let’s pretend we wanted to combine these arrays (I should’ve chosen something like Months and Years or States and Territories…but I’m sticking with dairy products and farm animals ….)
$combined = array(’Dairy’ => $dairy, ‘Animals’ => $animals);
//Idea: This is the best way to categorize interests for personalized profiles etc….
//Echoing what we’ve just done…
echo "I want to echo Cow!
?>
Of course, if you’re just wanting to echo Cow, just use echo “Cow”;…but if you’re building things from arrays like drop down menus or if you’re collecting interests, this is helpful.



March 21, 2008
Leave a Reply