In-Class Assignment Multi-Dimensional Array Example

This page shows a tip for how to create a multi-dimensional array that contains all the information on the products you want to display in your e-commerce site. I have created a multi-dimensional array called $products, that is defined in the included file product_array.php.

Here is what the raw $products array looks like, using the print_r() command

Array
(
    [0] => Array
        (
            [thumbnail_url] => images/product0.jpg
            [title] => A Delicious Cookie
            [description] => this cookie tastes the best
            [link_url] => http://www.amazon.com/Chips-Ahoy-Cookies-1-4-Ounce-Single-Serve/dp/B000F9Z2BS/ref=sr_1_1?ie=UTF8&s=grocery&qid=1257020667&sr=8-1
        )

    [1] => Array
        (
            [thumbnail_url] => images/product0.jpg
            [title] => A Less Delicious Cookie
            [description] => this cookie is not as good as the last one
            [link_url] => http://www.amazon.com/Geoff-Drews-Signature-Chocolate-Cookies/dp/B000FCI31G/ref=sr_1_4?ie=UTF8&s=gourmet-food&qid=1257020667&sr=8-4
        )

)
			

And here is how I would start to use the data in the array to display the first product:

A Delicious Cookie

this cookie tastes the best

click to view more info

A Less Delicious Cookie

this cookie is not as good as the last one

click to view more info