Hi,
I'm having an trouble trying to printf the string.
<?php
$product_name = "pencils";
$product_price= 7.99;
printf( "Product %f will cost %1.1f dollars.",
$product_name, $product_price );
?>
The answer should look like this
Product pencils will cost $7.99 dollars
but instead it looks like this
Product 0.000000 will cost 8.0 dollars.
The printf (), sprintf(), fprintf(), is something I'm learning right now.
Is there a rule of thumb to understand how this works because the printf word confused me a lot, I can't seem to find a way to remember how each function works correctly without looking at the definition. It's been like a week now and I can't seem to write it correctly.
Any Suggestion or solution would be appreciated. Thanks.