You can consider doing this: $number=102.52; $fraction=$number-floor($number); $number=($number % 50)+$fraction;
Basically it's the exact solution you're suggesting, just that you don't have to do any string stuff. PHP's behaviour is normal - modulus is generally intended for integers... Bogdan "Boget, Chris" wrote: > Consider the following: > > $number = 102.52; > > echo $number % 50; > echo bcmod( $number, 50 ); > > in both cases, it's spitting out "2". Why is it not spitting > out "2.52"? Is there a way I can get that information? > w/o having to parse the string, breaking it up, getting > the modulus and then adding it back into the end result...? > > Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]