it's a ternary operator

$string1 = (isset($string2)) ? $HTTP_GET_VARS['pid'] : "";

is the same as

if (isset($string2))
  $string1 = $HTTP_GET_VARS['pid'];
else
  $string1 = "";


-----Original Message-----
From: Gerard Samuel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 12:28 PM
To: PHP
Subject: [PHP] Explanation


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