<?
//#
//#
$sale_products =
array(
array("White_13", "50", "100")
array("Black_31", "50", "100")
array("Green_12", "50", "100")
);
foreach ($sale_products as $product) {
echo '
<div>
<div>Product Name: '.$product[1].'</div>
<div>Price: '.$product[2].'</div>
<div>SALE PRICE: '.$product[3].'</div>
</div>
';
}
//#
//#
?>
That is my code above. The white_1 etc are the SKU for each product.
Pop some commas on the end…
And you are almost there… arrays are zero indexed
Also if you wanted to make it a bit more readible you could use associative arrays…
It makes it longer but the order of the properties no longer matters… Below is another way of outputting variables in strings. Change to double quotes and use the { }…
Which approach is better is your call and depends on your use case.