Re: Re: New Operator

From: Date: Tue, 14 Mar 2006 15:06:33 +0000
Subject: Re: Re: New Operator
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-22412@lists.php.net to get a copy of this message
$ConfirmCode = (isset($_GET['ConfirmCode']) ? $_GET['ConfirmCode'] : '');
I agree that this is really a PITA, but until we get an operator for this, we should stuck on the ternary.
Another option is to use settype(); This has two advantages. One, if the variable does not exist, settype creates it with an empty value of the given type. Second, if it does exist, it can semitypecast them for you. settype($_GET['ConfirmCode'], "string"); or $ConfirmCode = $_GET["ConfirmCode"]; settype($ConfirmCode, "string"); Brian Moon dealnews.com

« previous php.internals (#22412) next »