Hi. can anyone help me with a PHP function where the integer and the decimal parts are extracted from a mixed number.
e.g.
$mix=123.456
$int=123
$dec=456
Thanx a lot!!!
extract integer and decimal part from mysql
Moderator: General Moderators
-
jolan_lars
- Forum Newbie
- Posts: 19
- Joined: Thu Oct 23, 2003 12:15 pm
Try this
Mark
Code: Select all
<?
function split_float($mix) {
$split = explode(".", $mix);
return $split;
}
$mix = 123.456;
$split = split_float($mix);
$int = $split[0]; // Integer
$dec = $split[1]; // Decimal
echo $int;
echo "<BR>";
echo $dec;
?>-
jolan_lars
- Forum Newbie
- Posts: 19
- Joined: Thu Oct 23, 2003 12:15 pm