Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in PHP only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
PHP
count number of digits after the decimal point
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
ilikemoney
New Member
Join Date:
Mar 2008
Posts:
1
#1
count number of digits after the decimal point
Mar 21 '08, 06:53 AM
i wanna know if theres a function or something that can count how many numbers there are after the decimal point using php...thanks
Markus
Recognized Expert
Expert
Join Date:
Jun 2007
Posts:
6092
#2
Mar 21 '08, 11:57 AM
I dont know if there's a function specified for this, but you could turn this into a function:
[php]
$_float = 1.9020441;
$_float = explode(".", $_float);
echo strlen($_float[1]);
[/php]
Regards :)
Comment
Post
Cancel
satas
New Member
Join Date:
Nov 2007
Posts:
82
#3
Mar 21 '08, 12:22 PM
This variant is also possible:
[PHP]$_float = 1.9020441123;
print strcspn(strrev( $_float), '.');[/PHP]
Regards.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment