note 113947 added to function.get-class
| From: | NanheKumar | Date: | Fri, 20 Dec 2013 12:14:14 +0000 |
| Subject: | note 113947 added to function.get-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-197989@lists.php.net to get a copy of this message | ||
<?php
class Parent{
}
class Child extends Parent{
}
$c = new Child();
echo get_class($c) //Child
?>
<?php
class Parent{
public function getClass(){
echo get_class();
}
}
class Child extends Parent{
}
$obj = new Child();
$obj->getClass(); //outputs Parent
?>
<?php
class Parent{
public function getClass(){
echo get_class($this);
}
}
class Child extends Parent{
}
$obj = new Child();
$obj->getClass(); // Parent
?>
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.get-class.php
Edit -- https://master.php.net/note/edit/113947
Del: integrated -- https://master.php.net/note/delete/113947/integrated
Del: useless -- https://master.php.net/note/delete/113947/useless
Del: bad code -- https://master.php.net/note/delete/113947/bad+code
Del: spam -- https://master.php.net/note/delete/113947/spam
Del: non-english -- https://master.php.net/note/delete/113947/non-english
Del: in docs -- https://master.php.net/note/delete/113947/in+docs
Del: other reasons-- https://master.php.net/note/delete/113947
Reject -- https://master.php.net/note/reject/113947
Search -- https://master.php.net/manage/user-notes.php