?
Solved

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

Posted on 2006-06-19
5
Medium Priority
?
1,209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 143

Accepted Solution

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

Expert Comment

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

Expert Comment

by:Richard Quadling
ID: 16933181
Oh!

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

Oh!
0
 
LVL 143

Expert Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

800 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