|
-
Oct 22nd, 2002, 03:43 PM
#1
Thread Starter
Frenzied Member
*solved* Make "3.66666666667" look like "3.66" ?
Hey ya,
I'm making a Top Site List at the moment, and In it i have a rating thing.
Well To get the rating i am doing
PHP Code:
$rating = $total_rating/$ratings;
But with this, i am getting:
$rating = "3.66666666667";
and what i want it to look like is:
$rating = "3.66";
How do i do this?
Last edited by wpearsall; Oct 22nd, 2002 at 05:58 PM.
Wayne
-
Oct 22nd, 2002, 04:44 PM
#2
Fanatic Member
ha, im sorry but i have to say a lame joke, take away 666666667!
-
Oct 22nd, 2002, 05:10 PM
#3
Thread Starter
Frenzied Member
Oh duh, never thought of dat, guess i should change my post to *solved* now huh ;0)
BTW: Meant VIA PHP -- This is a Random number .. but this is the number got when i just tested out the rating system :P
-
Oct 22nd, 2002, 05:51 PM
#4
Stuck in the 80s
Use the round() Function:
Code:
$rating = round("3.66666666667", 2);
-
Oct 22nd, 2002, 05:52 PM
#5
Stuck in the 80s
The precision part (second paramater) only works in PHP 4 and higher, by the way.
-
Oct 22nd, 2002, 05:56 PM
#6
Thread Starter
Frenzied Member
cool thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|