RE: [PHP] % operator
| From: | Eelco de Vries | Date: | Sun, 04 Feb 2001 09:02:46 +0000 |
| Subject: | RE: [PHP] % operator | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38083@lists.php.net to get a copy of this message | ||
It doesn't have a use in only PHP but in all programming languages.
It's a math thing .. u can get a remainder of a division.
10%8 = 2
12%8 = 4
10%5 = 0
12%5 = 2
Simple application:
$ppl = 23;
$grpsize = 7;
echo ("when $ppl people are divided over groups of $grpsize, ".
$ppl%$grpsize ." people are ungrouped.");
This operator can be used for more complex situations.
Cheers;
Eelco.
> Hi!
>
> what is the use of %
> Is it called modulo..what is it's use in PHP.?
>
>
> Thanx!
> Dhaval Desai
>
> __________________________________________________
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>