I try to insert 7 price values into a table and color the lowest price. I don't know where to place $lowestprice
. I'm aware it's poor code, but it worked until I try to add a color.
for ($i = 1; $i <= 7; $i++){
${"price".$i} = preg_replace($regexp, $match, ${"rawprice".$i});
if (preg_match('/'.$article.'/i', ${"stock".$i}))
{
$list[$i] = ${"price".$i};
$lowestprice = min($list);
if (preg_match('/^'.$lowestprice.'/i', ${"price".$i}))
{
echo ${"url".$i}." class=\"lowestprice\">".${"price".$i}." €</a></td>"; // lowest price in color with css
}
else
{
echo ${"url".$i}." class=\"price\">".${"price".$i}." €</a></td>";
}
}
else
{
echo "<td>Out of stock</td>";
}
}