Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17057 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25690 invoked by uid 1010); 1 Jul 2005 13:25:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25659 invoked from network); 1 Jul 2005 13:25:33 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 1 Jul 2005 13:25:33 -0000 X-Host-Fingerprint: 194.109.193.120 unknown Linux 2.4/2.6 Received: from ([194.109.193.120:49460] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 87/C8-29969-C4445C24 for ; Fri, 01 Jul 2005 09:25:32 -0400 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 09DAB10B9A3; Fri, 1 Jul 2005 15:25:33 +0200 (CEST) Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02459-05; Fri, 1 Jul 2005 15:25:31 +0200 (CEST) Received: from [192.168.1.16] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id F3DAD10B977; Fri, 1 Jul 2005 15:25:30 +0200 (CEST) Message-ID: <42C54445.7070106@iamjochem.com> Date: Fri, 01 Jul 2005 15:25:25 +0200 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pawel Bernat Cc: internals@lists.php.net References: <42C32829.60500@iamjochem.com> <20050701151327.A2920@vlo> In-Reply-To: <20050701151327.A2920@vlo> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at moulin.nl Subject: Re: [PHP-DEV] [Fwd: [PHP] constant() - php5] From: jochem@iamjochem.com (Jochem Maas) Pawel Bernat wrote: >>> >>$cnst = "DEBUG"; >> >>// what I want to do but can't >>if ($dbg = constant($cnst)) { >> // do stuff >>} >> >>// the only real option, it seems - bit long winded to get round a stupid (IMHO) >>if (defined($cnst) && ($dbg = constant($cnst))) { >> // do stuff >>} > > What is stupid with validating name before using it? its inconsistent to trigger an E_WARNING when doing: echo constant('CNST'); when: echo CNST; only triggers an E_NOTICE. (assuming, in both cases that CNST is not defined). IMHO it should at most trigger an E_NOTICE. > > p.