I use str_pad() for this, it can handle strings that vary in length much better then tabs:

tab way:
echo "long long name\t1000\t200.00\n";
echo "name\t10\t2.00\n";

output:
long long name  1000    200.00
name    10      2.00

str_pad way:
echo str_pad('long long name', 20,' ').
     str_pad('1000', 10,' ',STR_PAD_LEFT).
     str_pad('200.00', 10,' ',STR_PAD_LEFT).
     "\n";
echo str_pad('name', 20,' ').
     str_pad('10', 10,' ',STR_PAD_LEFT).
     str_pad('2.00', 10,' ',STR_PAD_LEFT).
     "\n";

output:
long long name            1000    200.00
name                        10      2.00

Marek

micro brew wrote:

I am sending an email using mail() and it works fine. But the formatting of the body of the email is wrong. I want to format part of it in columns sort of like
this:
Name Quantity Price


Can this be done neatly without using an html email?

Also what is the trick to making line returns display
properly in the email client?  I've tried using \r\n
with no luck.  I also tried \n.  The characters show
in the email but no line breaks.  Any suggestions?

TIA,

Mike

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to