Page 1 of 1

redefine constant in extended class

Posted: Fri Apr 03, 2009 2:58 pm
by mlecho
hi. i am extending a class that has a regex 'define' 'd in the parent class. I am wondering how i can 'redefine' that constant in my new class....is that possible? If so, is that correct below? Does not seem to be...

Code: Select all

 
define('VALID_EMAIL', "/regex_stuff/");
class ParentClass 
{
//class stuff
}
 
define('VALID_EMAIL', "/different_regex_stuff/");
class ChildClass extends ParentClass
{
//do similar stuff
}

Re: redefine constant in extended class

Posted: Fri Apr 03, 2009 3:57 pm
by php_east
fortunately constants cannot be redefined. they would'nt be constants if so.