Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43918 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11038 invoked from network); 12 May 2009 21:13:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2009 21:13:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=olafurw@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=olafurw@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.166 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: olafurw@gmail.com X-Host-Fingerprint: 209.85.219.166 mail-ew0-f166.google.com Received: from [209.85.219.166] ([209.85.219.166:44659] helo=mail-ew0-f166.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/FD-64369-786E90A4 for ; Tue, 12 May 2009 17:13:44 -0400 Received: by ewy10 with SMTP id 10so254376ewy.23 for ; Tue, 12 May 2009 14:13:40 -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:content-type; bh=mjCw3cMj1vSGGhivvb8CXnN2TvjrPL/vHS9r76SdEJ8=; b=Y2icafJbZYmXjtQBxN0vRag5O+Wpzaiv4ceRH8kA/VE/QhjXIT+pnWHFRxZlNX8jG/ ZmKOPMEs4H6RgOuZTErotRVEbVNn6Tni6uCtruo51WdbYbAzfdjppwLj55meRSBy2k2m l3qAqe2E5850iYGPfeMNkZawvSYmbY7Py29YE= 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 :content-type; b=PgnmwuEOoRnyp5YO9GFxpcI3kRG7tfHN98bjhfivcbuZoEfrU3wzx1/K379LWyKsZa cbsCCPe2nwpJxuVSfUhqfc157d8BiAYw6IGONFwy1+8zd1aZj7oqRKh3fUqX+XQDXijB Q9M2XmXlnKIrIDVKj9myURxk8YidTm1ydZaIs= MIME-Version: 1.0 Received: by 10.216.3.65 with SMTP id 43mr83930weg.149.1242162820810; Tue, 12 May 2009 14:13:40 -0700 (PDT) In-Reply-To: <4A09CE36.5070908@moonspot.net> References: <8c35d7690905120935t18722295i69217245c9296a6d@mail.gmail.com> <4A09CE36.5070908@moonspot.net> Date: Tue, 12 May 2009 21:13:40 +0000 Message-ID: <8c35d7690905121413ke040115w3080d95a514781c3@mail.gmail.com> To: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016e65681b0b008a00469bd9177 Subject: Re: [PHP-DEV] The constant use of isset() From: olafurw@gmail.com (=?ISO-8859-1?Q?=D3lafur_Waage?=) --0016e65681b0b008a00469bd9177 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 2009/5/12 Brian Moon > $foo =3D filter_input(INPUT_GET, "foo", FILTER_UNSAFE_RAW); > > That would have a value if set or null if not set. It also allows you to > validate it using filters if you wanted to. This of course only works wi= th > GPC variables, but it is a great solution. > > Brian. > -------- > http://brian.moonspot.net/ Can this be turned into a userland function? Olafur > > > On 5/12/09 11:35 AM, =D3lafur Waage wrote: > >> While researching for this suggestion I found this rfc proposal regardin= g >> ifsetor() ( http://wiki.php.net/rfc/ifsetor?s[]=3Disset< >> http://wiki.php.net/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 ) >> >> 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["baz"])&& >> $_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 = if >> it were set and false if it was not. >> >> Thanks for your time, i know this has probably been talked to death in o= ne >> form or other. >> >> =D3lafur Waage >> olafurw@gmail.com >> >> --0016e65681b0b008a00469bd9177--