Posted by Rich on 02/22/06 20:38
In article <a_idnaymMdq5xmfeRVn-iw@golden.net>, Smiley says...
>
>I taught myself PHP a few years ago and I use it frequently. Recently I
>downloaded a PHP script built by somebody else, and came across this piece
>of code:
>
>$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password']
>: '';
>
>I have never seen the question mark or colon used in this way before. I
>can't find any reference to it in my PHP book. Please tell me what it
>means.
>
>
The text to the left of the question mark "isset($HTTP_POST_VARS['password'])"
is the condition being tested. If the result is true, it uses the value on the
left side of the colon "$HTTP_POST_VARS['password']", If it's false then it uses
the value on the right side of the colon "''".
Rich
--
Newsguy -- http://newsguy.com
[Back to original message]
|