Re: Explanation
| From: | Hank Marquardt | Date: | Thu, 29 Nov 2001 00:27:25 +0000 |
| Subject: | Re: Explanation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75972@lists.php.net to get a copy of this message | ||
ternary operator ... if/else shorthand; here's the long way to to do it:
if(isset($string2)) {
$string1 = $HTTP_GET_VARS['pid'];
} else {
$string1 = "";
}
-or-
$string1 = "";
if(isset($string2)) {
$string1 = $HTTP_GET_VARS['pid'];
}
Hank
On Wed, Nov 28, 2001 at 08:28:12PM -0500, Gerard Samuel wrote:
> 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
Hank Marquardt <hank@yerpso.net>
http://web.yerpso.net
GPG Id: 2BB5E60C
Fingerprint: D807 61BC FD18 370A AC1D 3EDF 2BF9 8A2D 2BB5 E60C
*** Web Development: PHP, MySQL/PgSQL - Network Admin: Debian/FreeBSD
*** PHP Instructor - Intnl. Webmasters Assn./HTML Writers Guild
*** Beginning PHP -- Starts January 7, 2002
*** See http://www.hwg.org/services/classes