note 124303 added to function.get-parent-class
| From: | jake at qzdesign dot co dot uk | Date: | Thu, 17 Oct 2019 22:47:59 +0000 |
| Subject: | note 124303 added to function.get-parent-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212661@lists.php.net to get a copy of this message | ||
Note that from PHP 5.5 you can also use
parent::class from within a method, e.g.
<?php
function child()
{
echo "I'm ", parent::class, "'s son\n";
}
?>
Looks a bit tidier and technically probably more optimal, as it avoids a function call lookup.
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 37.152.240.115)
----
Manual Page -- http://php.net/manual/en/function.get-parent-class.php
Edit -- https://master.php.net/note/edit/124303
Del: integrated -- https://master.php.net/note/delete/124303/integrated
Del: useless -- https://master.php.net/note/delete/124303/useless
Del: bad code -- https://master.php.net/note/delete/124303/bad+code
Del: spam -- https://master.php.net/note/delete/124303/spam
Del: non-english -- https://master.php.net/note/delete/124303/non-english
Del: in docs -- https://master.php.net/note/delete/124303/in+docs
Del: other reasons-- https://master.php.net/note/delete/124303
Reject -- https://master.php.net/note/reject/124303
Search -- https://master.php.net/manage/user-notes.php