Advice on why a problem has happened
Posted: Wed Jan 27, 2010 10:28 am
So im new to php and have been working on differnet tuts for the past few days today tho I hit a snag, and have now a bigger problem!
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:
This is happening with each of my files, so I thinking I may have done something in th .ini file by accident...I really hope not though! Any help at all will be appriciated
R
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