On 17 May 2002 at 12:23, Jeff Field wrote:
$theValue = ($theValue != ) ? ' . $theValue . ' : NULL;
It's a shortened version of the if...else construct. As in...
condition ? this_if_true : this_if_false
--
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On Fri, May 17, 2002 at 12:23:45PM -0500, Jeff Field wrote:
I'm stumped by the
exact meaning in the following function of what the question mark's (?)
and colon's (:), mean and do?
That's the ternary comparison operator. See
http://www.php.net/manual/en/language.operators.comparison.php,
The ? in this senario is called the ternary operator
basically shorthand for an if/else statement e.g
$theValue = ($theValue != ) ? ' . $theValue . ' :NULL;
is the equivalent of
if($theValue != ) {
$theValue =$theValue ;
}
else{
$theValue =NULL;
}
- Original Message -
From: Jeff Field
3 matches
Mail list logo