RE: [PHP] What does a ? do
| From: | Boget, Chris | Date: | Tue, 20 Mar 2001 20:11:02 +0000 |
| Subject: | RE: [PHP] What does a ? do | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-44822@lists.php.net to get a copy of this message | ||
> Could someone plese explain this line if code??? What does the "?" do?
> $r = ($r < 1) ? $config['maxResults'] : $r;
It's short circuit IF (I believe that's the right word for it). This is the
same
thing as doing this:
if( $r < 1 ) {
$r = $config['maxResults'];
} else {
$r = $r;
}
Chris