Re: $i % 2 ? 0:
| From: | mike cullerton | Date: | Sat, 25 Aug 2001 16:47:24 +0000 |
| Subject: | Re: $i % 2 ? 0: | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64444@lists.php.net to get a copy of this message | ||
it's an if/else shortcut.
the part before the '?' is tested. '$i % 2' in your case.
the part after the '?' is returned if the test evals to true. '0' in your
case.
the part after the ':' is returned if the test evels to false. i've never
tried it with nothing after the ':' like in your case. guess it could be the
same as an if without an else.
hope this helps,
mike
on 8/25/01 10:38 AM, BRACK at brak@nettaxi.com wrote:
> Hi
>
> Can someone explain to me what "$i % 2 ? 0:" means or what it
> does step by step? I was looking in PHP docs for "?" and ":" and
> didn't find it there. I use this line in my script to assign different
> value for $bgcolor variable to color rows in result, but I want to
> understand what does it mean.
>
> Thank you in advance,
>
> Youri
> <>< <>< <>< <>< God is our provider ><>
> ><> ><> ><>
> http://www.body-builders.org
-- mike cullerton