Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22427 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5612 invoked by uid 1010); 14 Mar 2006 20:55:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5597 invoked from network); 14 Mar 2006 20:55:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2006 20:55:08 -0000 X-Host-Fingerprint: 200.252.148.190 unknown Received: from ([200.252.148.190:19239] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id FE/E7-55982-BAD27144 for ; Tue, 14 Mar 2006 15:55:08 -0500 Message-ID: To: internals@lists.php.net Date: Tue, 14 Mar 2006 17:55:05 -0300 References: <681504473.20060313203035@ionzoft.com> <2B.8D.55982.C32D6144@pb1.pair.com> <4416DBF9.6000006@dealnews.com> Lines: 27 User-Agent: KNode/0.10.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Posted-By: 200.252.148.190 Subject: Re: [PHP-DEV] Re: New Operator From: cunha17@gmail.com (Cristiano Duarte) Brian Moon wrote: >>> $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"); But you still don't have a default value, just an empty default value(string, zero, etc.). You can't i.e. initialize $_GET["ConfirmCode"] with "Yes" using settype... Regards, Cristiano Duarte