|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-03-31 01:21 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 09:00:01 2025 UTC |
Concerning the magical constant __CLASS__ <?php class foo { function a() { print __CLASS__ . "\n"; } } class bar extends foo { function b() { print __CLASS__ . "\n"; } } $foo = new foo; $bar = new bar; print '<pre>'; $foo->a(); // foo $bar->a(); // foo $bar->b(); // bar print '</pre>'; ?> I'm not sure about the definition of magical constant, but IMHO __CLASS__ should be changed to reflect the current class that it is in at that moment. This would be useful when use it in a static method where get_class() cannot be used.