I want to use multi dimensional arrays in a project I am doing, and I cannot figure out how to code it.
I have 3 things I want to store, a single string called "attribute name", another single string called "attribute type" and a collection of strings called "attributeOptions".
So if I had the data, attribute name="Brand", attribute type="sports", attribute options="nike|addidas|puma", I would want to be able to input and extract all of this information at once using a loop.
Am I thinking about multidimensional arrays the wrong way or how would I go about coding this in PHP?
Like this
$md = array (
"name" => "a",
"attribute" => "type",
"options" => array("Nike", "etc0", "etc1") // Array
);
$array['name'] = 'a';
$array['attribute'] = 'type';
$array['options'][0] = 'Nike';
$array['options'][1] = 'Nike or Other';
$array['options'][2] = 'Nike or Other Other';
Or you could do
$array['name'] = 'a';
$array['attribute'] = 'type';
$array['options']['optionOne'] = 'Nike';
$array['options']['optionTwo'] = 'Nike or Other';
$array['options']['optionThree'] = 'Nike or Other Other';
See?