Solved

How to get the decimal part alone from a float number.

Posted on 2006-06-19
5
1,202 Views
Last Modified: 2013-12-13
How to get the decimal part alone from a float number.
for eg : $x= 15.25
what to get .25 from $x

Thanks in advance.
LWord
0
Comment
Question by:lword
  • 3
  • 2
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 16933063
$x= 15.25;
$f = $x - (int)$x;
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 16933179
$f = fmod($x, 1);
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 16933181
Oh!

Hadn't been answered as I typed in my response.

Oh!
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 16933184
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16933616
Interesting answer, RQuadling. will try to remember that...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now