|
Posted by Chung Leong on 09/13/06 03:51
Jerry Stuckle wrote:
> Yes, it will take longer to execute and require more CPU. Rather than
> just accept the value as a string, the parser has to search through
> defined values to see if each string is defined or not. Additionally,
> PHP generates a notification for each one. The notification itself can
> be turned off, but the error handler still needs to run to find out the
> notification is not to be sent.
To be a little more precise, PHP would perform two look-ups in the
constant hash-table: once for case-sensititve match, another time for
case-insenstitive match. The overhead isn't that high, but it's
definitely slower than a literal string.
The bigger problem is the chance of a constant being defined under that
name. Not a recommended practice at all.
[Back to original message]
|