Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17060 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80124 invoked by uid 1010); 1 Jul 2005 14:15:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 80105 invoked from network); 1 Jul 2005 14:15:05 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 1 Jul 2005 14:15:05 -0000 X-Host-Fingerprint: 194.109.193.120 unknown Linux 2.4/2.6 Received: from ([194.109.193.120:49634] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 1E/1E-29969-2AF45C24 for ; Fri, 01 Jul 2005 10:13:54 -0400 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id 62F8010B9A2; Fri, 1 Jul 2005 16:13:54 +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 30940-16; Fri, 1 Jul 2005 16:13:50 +0200 (CEST) Received: from [192.168.1.16] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id 18C9210B977; Fri, 1 Jul 2005 16:13:50 +0200 (CEST) Message-ID: <42C54F98.20003@iamjochem.com> Date: Fri, 01 Jul 2005 16:13:44 +0200 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derick Rethans Cc: Pawel Bernat , internals@lists.php.net References: <42C32829.60500@iamjochem.com> <20050701151327.A2920@vlo> <42C54445.7070106@iamjochem.com> In-Reply-To: X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; 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) Derick Rethans wrote: > On Fri, 1 Jul 2005, Jochem Maas wrote: > > >>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. > > > Did you compare the output of the two statements? I did. > echo constant('CNST'); > shows nothing (except the warning) > > echo CNST; > shows "CNST" (and a notice). > > This makes perfect sense to me to differentiate between them like this. ok - agreed that the echo behaviour is logical - but I wasn't actually pertaining to the echo behaviour (and what was being echo'ed wasn't relevant to my original question). my point is that using a constant directly in your code when that constant doesn't exist only causes an E_NOTICE but passing a string to constant() when a constant of the given name doesn't exist causes an E_WARNING. I would either expect both to cause the same level of error OR that trying to use an undefined constant directly in code would cause a lower level of error. but if you say the error output behaviour is expected/correct/desired then I'm happy to except it (and adjust my expectations accordingly) - if you (anyone) could explain why (because I don't grok the logic behind this behaviour) I would be very grateful, maybe it will bring me one step closer to being able to call myself a real programmer. :-/ anyway thanks for taking the time to reply, I gather that you, Derick (amongst others!), have a plate full of PHP work in the form of unicode and date related stuff (which I am very much looking forward to!) - i.e. you are busy-busy, time is short, etc etc. kind rgds, Jochem > > Derick >