Re: grief with printf(), padding and alignment of text

From: Date: Wed, 12 Feb 2003 03:55:59 +0000
Subject: Re: grief with printf(), padding and alignment of text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-135263@lists.php.net to get a copy of this message
----- Original Message ----- From: "Robert E. Harvey, M.D." <rharvey@cox-internet.com> To: "php" <php-general@lists.php.net> Sent: Tuesday, February 11, 2003 6:21 PM Subject: [PHP] grief with printf(), padding and alignment of text > I'm running PHP 4.2.2 and I'm having trouble with the printf() > function. I want to be able to print data in space padded fields with > the alpha strings left justified and the numeric strings right > justified. For some reason I can't get printf() to pad with spaces. It > pads with " "-s and right aligns the data > > For example this code: printf("%' -20s %' 20s %' > -20s<br>\n",$algen, > $calc_amt, $range); > > returns this output: Algae 292 very high > which shows no padding. View source, and see what you find there. You should consider tables or replacing the spaces with the entity &nbsp;

« previous php.general (#135263) next »