I have an array that looks like this
$foreacharray = array(
"model" => array ("samsung", "sony", "philips", "acer", "hp"),
"qty" => array("3", "7", "5", "1", "8"),
);
What I'm trying to do is foreach model, draw the logo for the amount of its qty so Samsung = 3, Sony = 7 and so on will draw 3 Sony logos and 7 Samsung logos.
I came up with something like this
foreach ($foreacharray["model"] as $model)
{
foreach($foreacharray["qty"] as $qty)
{
echo $model;
echo '<br>';
}
}
But of course all that does is for each of the array entries, echo out the name so I end up with 5 samsungs being printed 5 sonys being printed etc.
How can I make this use the value of the qty array rather than the number of entries?