RE: [PHP] redefine constants

From: Date: Wed, 28 Feb 2001 16:33:22 +0000
Subject: RE: [PHP] redefine constants
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42026@lists.php.net to get a copy of this message
define() gives you a literal copy of the value of the second parameter. In this case your second parameter is __LINE__. The value of __LINE__ represents the current line number of the define statement. Once defined the value assigned remains constant, irrespective of whether or not __LINE__ changes later on. You could 'redefine' the value - but you'd just get the line number of the redefinition. You really want a reference (pointer) to the __LINE__ constant, however, you can't have references to constants. So, you just plain can't do it. If you think about it, this is a pain only with the parser 'constants', you wouldn't need a reference to your own constants as they never change. -----Original Message----- From: Christian Dechery [mailto:lemming@vento.com.br] Sent: 28 February 2001 16:13 To: php-general@lists.php.net Subject: [PHP] redefine constants why can't I redefine __LINE__? like define(LN,__LINE__); it's a rather big constant to put in code to generate my error messages, I was thinking more of L, or LN... but if I redefine it, it assumes the value of de redefine() line of code... so it's not really redefining a constant it's only atributing LN the value of __LINE__... and in the manual I saw examples where redefining constants were used... ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#42026) next »