Re: shorthand "if" notation
| From: | Pete Morganic | Date: | Thu, 12 Jun 2003 12:59:32 +0000 |
| Subject: | Re: shorthand "if" notation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151237@lists.php.net to get a copy of this message | ||
Its a ternary operator
look at
http://www.phpbuilder.com/board/showthread.php?threadid=10235547
http://www.phpbeginner.com/columns/maxim/ternary
pete
Adrian Greeman wrote:
I am confused by the shorthand "if" notation. For example I just saw this PHP snippet on another forum <? $bkgndClass = $bkgndClass == "darkBkgnd" ? "liteBkgnd" : "darkBkgnd"; } ?>I think it is an if but cannot find it in the manual. Howis that written in the more normal notation - if(){} etc?? [And please excuse a slightly off-thread but related extension to the question but I have seen similar in Javascript - namely --- var evt = (evt ? evt : ((window.event) ? window.event : null); is this the same notation or something else?]Regards Adrian Greeman