Re: [PHP] Modulus and floating point...

2002-01-04 Thread Bogdan Stancescu
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

[PHP] Modulus and floating point...

2002-01-04 Thread Boget, Chris
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 ba

Re: [PHP] Modulus Formatting

2001-02-06 Thread Web Admin
at's all ;-) Ahmad Anvari - Original Message - From: Michael Hall To: PHP List Sent: Tuesday, February 06, 2001 10:03 AM Subject: [PHP] Modulus Formatting > I can pull data out of a database using mysql_fetch_array and assemble it like this using a w

[PHP] Modulus Formatting

2001-02-05 Thread Michael Hall
> I can pull data out of a database using mysql_fetch_array and assemble it like this using a while statement: > > $data > $data > $data > etc ... > > What I'd like to do is assemble it like this: > > $data$data$data > etc... > > In other words, I need a break () every three times through th

Re: [PHP] Modulus

2001-01-26 Thread Chris Lee
4%2 = 0 4 div 2 equals remainder 0 2 div 4 doesnt divide so your left with the remainder equal to what you started with, 2 -- Chris Lee Mediawaveonline.com [EMAIL PROTECTED] ""Mike P"" <[EMAIL PROTECTED]> wrote in message 94qjq0$rde$[EMAIL PROTECTED]">news:94qjq0$rde$[EMAIL PROTECTED]..

Re: [PHP] Modulus

2001-01-26 Thread Teodor Cimpoesu
Hi Mike! On Thu, 25 Jan 2001, Mike P wrote: > I know i'm a liitle slow but why does 2%4 = 2 and not 0 or 1 cause 4*0+2=2 > thanks > Mike > [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-ma

[PHP] Modulus

2001-01-26 Thread Mike P
I know i'm a liitle slow but why does 2%4 = 2 and not 0 or 1 thanks Mike [EMAIL PROTECTED] -- 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