Q:

PHP syntax with ? and :

Possible Duplicate:
What is the PHP ? : operator called and what does it do? 

I found the answer to something I was looking for, but I don't quite understand the syntax because they used, I think, short tags.  Here is the code:
$temp = is_array($value) ? $value : trim($value);

Could someone explain how this works?  I think this means if true, return the value and if false return the value trimmed, but I'm not sure.  Can there be more than two options, or is it strictly true and false?

A:

You are correct. This is a conditional operator, ?: is a ternary operator.
<?php

// Example usage for: Ternary Operator
$temp = is_array($value) ? $value : trim($value);

// The above is identical to this if/else statement
if (is_array($value)) {
    $temp = $value;
} else {
    $temp = trim($value);
}

?>

Take a look half way down this page for more information:
http://php.net/manual/en/language.operators.comparison.php

