|
Author |
Message |
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Tue May 13, 2003 8:43 pm (21 years, 1 month ago) |
|
Im doing batting averages on my site and want to format a number like this,
0 = .000 and .11 = .110 etc. |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed May 14, 2003 5:28 am (21 years, 1 month ago) |
|
|
|
|
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Wed May 14, 2003 4:33 pm (21 years, 1 month ago) |
|
That works perfect, but is there a way to take the 0 off the front
0.500 > .500 |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed May 14, 2003 4:40 pm (21 years, 1 month ago) |
|
Not sure, but I can provide a dirty way of doing it
Code: | $variable = str_replace('0.', '.', $variable); |
|
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Wed May 14, 2003 4:55 pm (21 years, 1 month ago) |
|
explode() would have been my suggestion, but I guess str_replace is just as good. |
________________________________ It's turtles all the way down... |
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.130556 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |