The manual is rather sparse about the ternary operator, you may find one
sentence about it here:
http://php.he.net/manual/en/language.operators.comparison.php

Basically if the expression before the ? evaluates to true then the whole
expression evaluates to the expression after the ?.  If the expression
before the ?  evaluates to false then the whole expression evaluates to the
expression after the :

This is a really effective shorthand for if..then...else if you are just
going to assign different values to a variable based on the outcome of the
if statement.

Fred

Gerard Samuel <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi.  Im looking over someone else's code and I come across something I
> dont understand and dont know where in the manual to look for it.
> Here is an example ==>
>
> $string1 = (isset($string2)) ? $HTTP_GET_VARS['pid'] : "";
>
> I have no idea what the '?' in the line and the ':' at the end, so I
> have no way of interpreting what $string1 could be.
> If you could point me to the page in the manual that would be great.
>
> Thanks...
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to