Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43905 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57255 invoked from network); 12 May 2009 16:51:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2009 16:51:56 -0000 Authentication-Results: pb1.pair.com header.from=olafurw@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=olafurw@gmail.com; spf=pass; sender-id=pass 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:60720] helo=mail-ew0-f166.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/83-64369-B29A90A4 for ; Tue, 12 May 2009 12:51:56 -0400 Received: by ewy10 with SMTP id 10so47952ewy.23 for ; Tue, 12 May 2009 09:51:51 -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=urlMl18fiE8R0LtCtKg3XowVHeWdiCkBfYtoaD2l9pc=; b=owvNtY/fnOgAQB7nTNeAQSeYrxqbvE6cBjocebTUjiE6l/WUb+b34TNSEA3oca7tOC Ar3DIiywturCkXdhSaQbMLBIDharmk09lgmFDUo2wKRzgW8j67KCEM11cqpA9BU3vOua Q6MEvM52uizXs0Breuc9ExO/JpdmkCZY7nDCI= 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=a6s4ef8m9/LwKGupS420K6xS5qYEhE7z95NDZSDBiovMHyHNA3wPUmcIzweVr6lLvy ljAoOPhTUyoNMftnqnPTZaPkENHptiviD1OKB27+W7ieMlG5fFKsTYDmlh5b0IWGdzNx 777kzelFV6AKgYYcpNXRpxEbuzR/m2mZMVgCE= MIME-Version: 1.0 Received: by 10.216.21.206 with SMTP id r56mr4116607wer.110.1242147111567; Tue, 12 May 2009 09:51:51 -0700 (PDT) In-Reply-To: <4A09A709.6010000@daevel.net> References: <8c35d7690905120935t18722295i69217245c9296a6d@mail.gmail.com> <4A09A709.6010000@daevel.net> Date: Tue, 12 May 2009 16:51:51 +0000 Message-ID: <8c35d7690905120951x652f9a73r105ab07882fb2704@mail.gmail.com> To: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016364c71ad58021f0469b9e9d7 Subject: Re: [PHP-DEV] The constant use of isset() From: olafurw@gmail.com (=?ISO-8859-1?Q?=D3lafur_Waage?=) --0016364c71ad58021f0469b9e9d7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The error suppression was discussed in the rfc and yes it is not clean and you could be suppressing something else inadvertently. Yes the false value would be an issue with this, but for 0, empty array and empty string is an issue with just about anything else in PHP already. Henc= e =3D=3D=3D if you want to be strict with it. 2009/5/12 Olivier B. > So if the variable is set and contains "false", we can't check it ? > And near same problem for 0, empty array and empty string. > > But you can also use this syntax : (yes it's not very "clean") > > if( @$_GET['foo'] =3D=3D=3D 'bar') > or > if( @$_GET['foo'] =3D=3D=3D 'bar' or @$_GET['baz'] =3D=3D=3D 'bat' ) > > > Olivier > > =D3lafur Waage a =E9crit : > >> While researching for this suggestion I found this rfc proposal regardin= g >> 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["b= az"]) >> && >> $_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 >> >> >> > --0016364c71ad58021f0469b9e9d7--