note 87127 added to language.constants
| From: | FrancoisHill at osu1 dot php dot net | Date: | Thu, 20 Nov 2008 14:41:38 +0000 |
| Subject: | note 87127 added to language.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146755@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 89.31.146.176
Probable Submitter: 194.153.88.6
----
Manual Page -- http://www.php.net/manual/en/language.constants.php
Edit -- https://master.php.net/note/edit/87127
Del: integrated -- https://master.php.net/note/delete/87127/integrated
Del: useless -- https://master.php.net/note/delete/87127/useless
Del: bad code -- https://master.php.net/note/delete/87127/bad+code
Del: spam -- https://master.php.net/note/delete/87127/spam
Del: non-english -- https://master.php.net/note/delete/87127/non-english
Del: in docs -- https://master.php.net/note/delete/87127/in+docs
Del: other reasons-- https://master.php.net/note/delete/87127
Reject -- https://master.php.net/note/reject/87127
Search -- https://master.php.net/manage/user-notes.php