Question about \n - Does not seem to work - Please help
Posted: Fri Apr 06, 2007 9:50 am
Everah | Please use
A line break is not showing up after each "printf" and it appears as one long continuous string....why isn't the \n working?
Thank very very much in advance for anyone that can help me!
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
I JUST started learning php and have a very simple question. I honestly tried to look around to find an answer, but can't seem to find one.
Like I said, I am a 100% beginner - so please excuse this simple question!
I am writing a short little code, and all I want is to add line breaks after a printf command. My code looks like this:Code: Select all
<?php
$ham = 4.95;
$shake = 1.95;
$cola = .85;
$food = 2 * $ham + $shake + $cola;
$tax = $food *.075;
$tip = $food *.16;
$total = $food + $tip + $tax;
printf("%1d %3s at \$%.2f each: \$%.2f\n", 2, 'ham', $ham, 2 * $ham);
printf ("%1d %5s at \$%.2f each: \$%.2f\n", 2, 'shake', $shake, 2 * $shake);
?>Thank very very much in advance for anyone that can help me!
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]