Jump to content

Umm what does this mean


desithugg

Recommended Posts

Ternary operator. It's a shorthand for an IF-THEN-ELSE.

 

condition ? true_expression : false_expression

 

If the condition is true, evaluate the true_expression, otherwise evaluate the false_expression.

 

In your example:

 

$real_result = $boolean_result ? 1 : 0;

 

is equivalent to:

 

if ($boolean_result)
{
   $real_result = 1;
}else{
   $real_result = 0;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.