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
IAD
Forum Commoner
Posts: 42 Joined: Wed Dec 28, 2005 12:36 pm
Location: Israel, Soon Canada :)
Post
by IAD » Sun Jan 01, 2006 12:47 am
Hey,
i can't remmeber the functiopn that make numbers shorter, for example: 0.55453212 will be 0.55
Happy new year, Tal.
mickd
Forum Contributor
Posts: 397 Joined: Tue Jun 21, 2005 9:05 am
Location: Australia
Post
by mickd » Sun Jan 01, 2006 3:40 am
Round is capable for what your asking.
IAD
Forum Commoner
Posts: 42 Joined: Wed Dec 28, 2005 12:36 pm
Location: Israel, Soon Canada :)
Post
by IAD » Sun Jan 01, 2006 4:01 am
Not exactly, round makes number like 1.9 to 2, what i wanted is to turn number like: 0.45812 to 0.458, and then i got remember at "substr();"
Code: Select all
<?Php
$num = "1.3334";
print substr($num,0,5); // will return 1.333
?>
Tal
mickd
Forum Contributor
Posts: 397 Joined: Tue Jun 21, 2005 9:05 am
Location: Australia
Post
by mickd » Sun Jan 01, 2006 6:21 am
ah, so you dont want the numbers to be rounded up/down. my mistake.