Re: Enhanced __CLASS__ constant

From: Date: Thu, 22 Jan 2009 16:08:37 +0000
Subject: Re: Enhanced __CLASS__ constant
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-42785@lists.php.net to get a copy of this message
Why not just enhance get_class() function to accept the object itself (not only the instance)?
This means: - No new keyword - No magic Foo::__MIRACLEHERE__ - No 50 pages documentation to help user
Hi, You can't do this. get_class(SomeClass) would attempt to pass constant named SomeClass to the function. In PHP you can have constant/function/class of the same name and the only way to tell them apart is context. It needs to be either a magic constant or a language construct. Regards, Stan Vassilev

« previous php.internals (#42785) next »