note 82692 deleted from language.constants by danbrown
| From: | danbrown@php.net | Date: | Fri, 12 Jun 2009 22:18:11 +0000 |
| Subject: | note 82692 deleted from language.constants by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156824@lists.php.net to get a copy of this message | ||
Note Submitter: sgbohu at ~NOSPAM~gmail dot com
----
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"
?>