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
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
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]..
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
4 matches
Mail list logo