Re: question
| From: | skate | Date: | Sun, 30 Mar 2003 13:59:38 +0000 |
| Subject: | Re: question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-141641@lists.php.net to get a copy of this message | ||
ahkay, makes perfect sense now :)
thanks
----- Original Message -----
From: "Don Read" <dread@texas.net>
To: "skate" <root@fatcuban.com>
Cc: <php-general@lists.php.net>
Sent: Sunday, March 30, 2003 2:19 PM
Subject: Re: [PHP] question
>
> On 30-Mar-2003 skate wrote:
> > excuse me for being dumb, but can you explain this line for me?
> >
> > if (! (++$i % 2))
> >
>
> If $i is evenly divisible by 2 then ($i % 2) evaluates to 0 or (false).
> The (! ($i % 2)) inverts the meaning to (true) so the statements within
> the if block are executed.
>
> The ++$i bit --well it's a handy spot to increment $i, and the
pre-increment
> notation gets around the case when $i == 0.
>
> Regards,
> --
> Don Read dread@texas.net
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>