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

Re: [PHP] Modulus Formatting

2001-02-06 Thread Web Admin
Hi Michael, Use a temporary variable [counter], if counter%3 == 0 then write in the output. $counter=0; print ""; while($row = mysql_fetch_array($result)) { echo "".$row["user_id"].""; $counter++; if (!$counter%3) { echo ""; } } That's all ;-) Ahmad Anvari - Original Messa

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