Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43908 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65983 invoked from network); 12 May 2009 17:23:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2009 17:23:51 -0000 Authentication-Results: pb1.pair.com header.from=lewiswright@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=lewiswright@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.44.30 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: lewiswright@gmail.com X-Host-Fingerprint: 74.125.44.30 yx-out-2324.google.com Received: from [74.125.44.30] ([74.125.44.30:27751] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BE/65-64369-5A0B90A4 for ; Tue, 12 May 2009 13:23:50 -0400 Received: by yx-out-2324.google.com with SMTP id 8so53896yxg.83 for ; Tue, 12 May 2009 10:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=LbImn4gwQ7O6wK6HN+KQxiedvn0LXTenLIFyah60WJE=; b=ujGBzSv7JEfdCToBbAVKSWhHaRQ3KDeKEzm7vRb7pbz06i8gGHiqYZlOGHaY/RVmaS xkRomd5fpy6tb61EusdkA4pUFF7wweVREaYVfg87A7hlRF4fMqJrKr0nxwRRks7rm3lK /YCHpnIs6SaAXG2XIJGKJqE8DNAbGtrns21KU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=B3RI66EnB4YSi5GJYntXzPvboIfrKrSIBX/G/qeY5ZXbR7ABPEX4+OBVqkaEYPddux /LUTWyGqp24hJ8dCfD1tXwC4lZQNceqVSA3aLzHzy+e5kBWH3Z4hi0wDIRHFJjTMaA7E 0p7cI9QZT+1aNH+aFXqW09pWS+z2XIPy8JVAI= MIME-Version: 1.0 Received: by 10.151.6.2 with SMTP id j2mr185285ybi.88.1242149027360; Tue, 12 May 2009 10:23:47 -0700 (PDT) In-Reply-To: <8c35d7690905120935t18722295i69217245c9296a6d@mail.gmail.com> References: <8c35d7690905120935t18722295i69217245c9296a6d@mail.gmail.com> Date: Tue, 12 May 2009 18:23:47 +0100 Message-ID: To: =?ISO-8859-1?Q?=D3lafur_Waage?= Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] The constant use of isset() From: lewiswright@gmail.com (Lewis Wright) Regarding ifsetor, what's wrong with just using this: isset($myvar) OR $myvar =3D 'i am set'; It works in just the same way and has no problems. I agree it would be great though if there could be a function to retrieve a variable's value if it exists, without throwing an error if it doesn't exist. I'm not sure if isset would be appropriate though. Lewis. 2009/5/12 =D3lafur Waage : > While researching for this suggestion I found this rfc proposal regarding > ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=3Disset) > and it's rejection point was that it was currently not possible ( > http://marc.info/?l=3Dphp-internals&m=3D108931281901389&w=3D2 ) > > But would it be possible to check for a value of a variable if it is set? > > Since I often do (and see others do) > > if(isset($_GET["foo"]) && $_GET["foo"] =3D=3D "bar") > or even worse > if((isset($_GET["foo"]) && $_GET["foo"] =3D=3D "bar") || (isset($_GET["ba= z"]) && > $_GET["baz"] =3D=3D "bat")) > > to be able to do something like this > > if(isset($_GET["foo"]) =3D=3D "bar") > or > if(isset($_GET["foo"]) =3D=3D "bar" || isset($_GET["baz"]) =3D=3D "bat") > > That isset (or some other language construct) would return the variable i= f > it were set and false if it was not. > > Thanks for your time, i know this has probably been talked to death in on= e > form or other. > > =D3lafur Waage > olafurw@gmail.com >