Wondering if someone might be able to help me out with this, for some reason it just doesnt want to work. Perhaps even a suggestion of another way to do it.
As always, much thanks in advance!
$allproducts contains
3:Ink
5:Chalk
9:Pens
<?
$eachproduct=explode("\n",$allproducts);
foreach($eachproduct AS $productandamount){
list($amnt,$product) = explode(":", $productandamount);
echo"$amnt x $product<br>"; //this is correct and echoes correctly
$product=strtolower($product);
$myarray[$product]=$amnt;
}
$newproduct='Ink';
$newproduct=strtolower($newproduct);
echo $myarray[$newproduct];
//this should echo out 3
?>