Re: [PHP] redefine constants
consants must be scalar, they can not be references. http://php.net/manual/en/function.define.php what your looking for is this. this is invalid syntax though, I dont know how to answer your question though, sorry :( -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] "Christian Dechery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] redefine constants
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:[EMAIL PROTECTED]] Sent: 28 February 2001 16:13 To: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]