note 87127 deleted from language.constants by danbrown
| From: | danbrown@php.net | Date: | Fri, 12 Jun 2009 22:17:54 +0000 |
| Subject: | note 87127 deleted from language.constants by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156820@lists.php.net to get a copy of this message | ||
Note Submitter: Francois Hill
----
As a follow-up to Sinured's 19-Jul-2007 09:27 note :
I have also noticed PHP (my version i.e. 5.2.0) allows more characters than specified in
constant's names. The slash character ("/") seems to be allowed, notably.
I have used that "feature" to produce uniquely named constants in my different files :
<? php
//This line is copied-pasted in all files, needs not be adpated
define('PATH_FILE_THIS'.__FILE__ ,realpath(dirname(__FILE__)));
//Use constant :
include constant('FPL__PATH_FILE_THIS'.__FILE__).'../etc.';
?>
Had "/" not been a admissible character in a constant's name, hash functions would
probably have to have been considered.