|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-27 08:27 UTC] wildmaple at yahoo dot com
[2005-01-28 23:26 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 07:00:02 2025 UTC |
Description: ------------ get_class() invoked with no argument, always return the original classname, in which it is first referenced. Reproduce code: --------------- #!/bin/php <?php class parentCls{ static function initPStatic(){ echo("parentCls::initPStatic said get_class()=='".get_class()."'\n"); echo("\n"); } function initP(){ echo("parentCls::initP said get_class()=='".get_class()."'\n"); echo("\n"); } } class childCls extends parentCls{ } childCls::initPStatic(); $c=new childCls(); $c->initP(); ?> Expected result: ---------------- parentCls::initPStatic said get_class()=='childCls' parentCls::initP said get_class()=='childCls' Actual result: -------------- parentCls::initPStatic said get_class()=='parentCls' parentCls::initP said get_class()=='parentCls'