note 82692 added to language.constants

From: Date: Tue, 22 Apr 2008 11:25:17 +0000
Subject: note 82692 added to language.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-138651@lists.php.net to get a copy of this message
In response to tudor at tudorholton dot com 10-Jul-2007 02:15 The error message does not give incorrect information. The error indeed is that you did not quote the constant name and PHP tries therefore to use it as a constant. Since it is not defined, PHP assumes that you meant to quote it and evaluates it as a string. While this is invalid : <?php define( MY_CONST, 'blah'); ?> This will work : <?php define( 'CONST_NAME', 'MY_CONST' ); define( CONST_NAME, 'blah'); var_dump( CONST_NAME ); // output : string(8) "MY_CONST" var_dump( MY_CONST ); // output : string(4) "blah" ?> ---- Server IP: 217.174.223.124 Probable Submitter: 193.189.91.57 ---- Manual Page -- http://www.php.net/manual/en/language.constants.php Edit -- https://master.php.net/note/edit/82692 Del: integrated -- https://master.php.net/note/delete/82692/integrated Del: useless -- https://master.php.net/note/delete/82692/useless Del: bad code -- https://master.php.net/note/delete/82692/bad+code Del: spam -- https://master.php.net/note/delete/82692/spam Del: non-english -- https://master.php.net/note/delete/82692/non-english Del: in docs -- https://master.php.net/note/delete/82692/in+docs Del: other reasons-- https://master.php.net/note/delete/82692 Reject -- https://master.php.net/note/reject/82692 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138651) next »