I need to figure out the best way to put together an array where multiple keys have the same value. For example,I need to return LARGE if any of the following values are provided:
"lrge", "lrg", "lg"
I think it should be in a form of multidimensional array. Something like:
$myArr= array (
"color" = array (
"RED" => array("red", "rd", "r"),
"BLUE" => array("blue", "blu", "bl")
),
"size" = array (
"LARGE" => array("lrge", "lrg", "lg"),
"SMALL" => array("smal", "sml", "sm")
)
);
Having a blank moment on how to use it:
$cat = "size";
$val = "lrg";
echo ... // need to return LARGE
foreachandin_array()are your best friends for this task. But for bonus points I would change the format of the list to express the mapping in the other direction.