Solved

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

Posted on 2006-06-19
5
1,207 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 500 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 40

Expert Comment

by:Richard Quadling
ID: 16933184
0
 
LVL 143

Expert Comment

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

730 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