PRINTF() help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
warrenk
Forum Newbie
Posts: 13
Joined: Wed Nov 01, 2006 8:46 am

PRINTF() help

Post by warrenk »

I am trying to line up the decimal places. Here is the code that I am using...

echo("<td>");
printf("%8.2f\n",$dspcst);
echo("</td>");

Is there anyway to right justify the output so the decimal places line up? The above code seems to left justify my output.

Thanks for any help!
Warren
pwd
Forum Newbie
Posts: 2
Joined: Wed Nov 01, 2006 8:26 am

Re: PRINTF() help

Post by pwd »

warrenk wrote:I am trying to line up the decimal places. Here is the code that I am using...

echo("<td>");
printf("%8.2f\n",$dspcst);
echo("</td>");

Is there anyway to right justify the output so the decimal places line up? The above code seems to left justify my output.
<td align='right'>

or

<td style='text-align:right'>
warrenk
Forum Newbie
Posts: 13
Joined: Wed Nov 01, 2006 8:46 am

Post by warrenk »

PWD...

Thanks for your help! This worked great! :D

Warren
Post Reply