Page 1 of 1

manipulating decimals

Posted: Fri Oct 31, 2008 4:53 am
by ianmullineaux
Hi
I need to be able to seperate a decimal into two parts - the numbers before the decimal and those after and store them in 2 variables with no rounding taking place...

for example:

for the number 45.25

$a = 45
$b = 25

Can someone point me in the right direction please
Thanks

Ian

Re: manipulating decimals

Posted: Fri Oct 31, 2008 5:07 am
by onion2k

Code: Select all

$number = 46.25;
$a = floor($number);
$b = $number - $a;