Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43915 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83956 invoked from network); 12 May 2009 19:14:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2009 19:14:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=jared.williams1@ntlworld.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jared.williams1@ntlworld.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ntlworld.com designates 81.103.221.48 as permitted sender) X-PHP-List-Original-Sender: jared.williams1@ntlworld.com X-Host-Fingerprint: 81.103.221.48 mtaout02-winn.ispmail.ntl.com Solaris 10 (beta) Received: from [81.103.221.48] ([81.103.221.48:41079] helo=mtaout02-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/D8-64369-D9AC90A4 for ; Tue, 12 May 2009 15:14:39 -0400 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090512191434.VOBZ588.mtaout02-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Tue, 12 May 2009 20:14:34 +0100 Received: from p2 ([82.0.126.169]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090512191434.WXGR22934.aamtaout04-winn.ispmail.ntl.com@p2> for ; Tue, 12 May 2009 20:14:34 +0100 To: Date: Tue, 12 May 2009 20:15:24 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcnTH8UKTwKYZwqfRsa+tTVIwvmzYgAFfXAg In-Reply-To: <8c35d7690905120935t18722295i69217245c9296a6d@mail.gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4325 Message-ID: <20090512191434.WXGR22934.aamtaout04-winn.ispmail.ntl.com@p2> X-Cloudmark-Analysis: v=1.0 c=1 a=a1M_QXR9M3sA:10 a=QkSC1ZPBO30A:10 a=pGLkceISAAAA:8 a=67BIL_jfAAAA:8 a=gu6fZOg2AAAA:8 a=6_2zBkrUQ5UwYlGCo5YA:9 a=d5pNnuquyeGwhl18bmgA:7 a=tbKEFMfJZyiwmoml9jxdlG9sJSMA:4 a=MSl-tDqOz04A:10 Subject: RE: [PHP-DEV] The constant use of isset() From: jared.williams1@ntlworld.com ("Jared Williams") References: <8c35d7690905120935t18722295i69217245c9296a6d@mail.gmail.com> =20 > -----Original Message----- > From: =D3lafur Waage [mailto:olafurw@gmail.com]=20 > Sent: 12 May 2009 17:35 > To: internals@lists.php.net > Subject: [PHP-DEV] The constant use of isset() >=20 > While researching for this suggestion I found this rfc=20 > proposal regarding > ifsetor() (=20 > http://wiki.php.net/rfc/ifsetor?s[]=3Disset rfc/ifsetor?s%5B%5D=3Disset>) > and it's rejection point was that it was currently not possible ( > http://marc.info/?l=3Dphp-internals&m=3D108931281901389&w=3D2 ) >=20 > But would it be possible to check for a value of a variable=20 > if it is set? >=20 > Since I often do (and see others do) >=20 > if(isset($_GET["foo"]) && $_GET["foo"] =3D=3D "bar") or even worse > if((isset($_GET["foo"]) && $_GET["foo"] =3D=3D "bar") ||=20 > (isset($_GET["baz"]) && $_GET["baz"] =3D=3D "bat")) >=20 > to be able to do something like this >=20 > if(isset($_GET["foo"]) =3D=3D "bar") > or > if(isset($_GET["foo"]) =3D=3D "bar" || isset($_GET["baz"]) =3D=3D = "bat") >=20 > That isset (or some other language construct) would return=20 > the variable if it were set and false if it was not. >=20 > Thanks for your time, i know this has probably been talked to=20 > death in one form or other. >=20 > =D3lafur Waage > olafurw@gmail.com >=20 Use array_merge to provide default values...=20 $get =3D array_merge($_GET, array('foo' =3D> 'bar', 'baz' =3D> 'bat)); If ($get['foo'] =3D=3D 'bar' || $get['baz'] =3D=3D 'bat') Jared