Printf command printing unwanted carriage return
Posted: Thu Aug 30, 2007 2:40 am
I have a very small segment of code that's been bothering me for a while but not enough for me to really do anything about it until now.
My problem is, I'm using a printf command to print a formatted decimal, but there's an unwanted carriage return (two, actually) in there, so instead of getting
"Number: [5.02]"
I get
"Number:[
5.02
]"
using essentially the code below
I made sure to get rid of white spaces in between the ending php tag and the html div's just in case....I'm figuring it's something with printf that inserts a carriage return like that by default. Is there some way to disable or counteract this?
Any help appreciated, thanks!
--Tony
My problem is, I'm using a printf command to print a formatted decimal, but there's an unwanted carriage return (two, actually) in there, so instead of getting
"Number: [5.02]"
I get
"Number:[
5.02
]"
using essentially the code below
Code: Select all
<? echo("Number: [");
?><div id="blah"><?
printf('%03.1f',($test));
?></div><? echo(']'); ?>Any help appreciated, thanks!
--Tony