Can annoyone tell me why I am getting this:
"222.4", "Candle Stick" => "4", "Coffee Table" => "80.6"); echo "
";
printf("%-20s%20s\n", "Name", "Price");
printf("%'-41s\n", " ");
foreach ($products as $key=>$val) {
printf("%-20s%20.2f\n", $key, $val );
}
echo "
"; ?>
instead of what i should be getting from this code:
Code: Select all
<?php
$products = array("Green Chair" => "222.4", "Candle Stick" => "4", "Coffee Table" => "80.6");
echo "<pre>";
printf("%-20s%20s\n", "Name", "Price");
printf("%'-41s\n", " ");
foreach ($products as $key=>$val) {
printf("%-20s%20.2f\n", $key, $val );
}
echo "</pre>";
?>R