note 62253 added to language.constants

From: Date: Thu, 23 Feb 2006 10:24:23 +0000
Subject: note 62253 added to language.constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-104289@lists.php.net to get a copy of this message
I find variables much more flexible than constants because variables can be used inside quotes and heredocs etc. Especially for language systems, this is nice. As stated in one of the previous notes, there is no speed penalty by using variables. However, one issue is that you risc name collision with existing variables. When implementing a language system I simply found that adding a prefix to all the variables was the way to go, for example: $LNG_myvar1 = "my value"; That is easier and performs faster than using arrays like $LNG['myvar'] = "my value"; As a final note, implementing a new superglobal in PHP would make using constants much more beneficial. Then it could be used in qoutes like this: "The constant myconst has the value $CONSTANTS[myconst] !" ---- Server IP: 217.160.72.57 Probable Submitter: 212.242.137.7 ---- Manual Page -- http://www.php.net/manual/en/language.constants.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62253 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62253&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62253&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104289) next »