note 115790 added to function.get-called-class

From: Date: Wed, 24 Sep 2014 07:00:42 +0000
Subject: note 115790 added to function.get-called-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-200512@lists.php.net to get a copy of this message
As of PHP 5.5 you can also use "static::class" to get the name of the called class. <?php class Bar { public static function test() { var_dump(static::class); } } class Foo extends Bar { } Foo::test(); Bar::test(); ?> Output: string(3) "Foo" string(3) "Bar" ---- Server IP: 160.75.25.15 Probable Submitter: 82.222.51.130 ---- Manual Page -- http://php.net/manual/en/function.get-called-class.php Edit -- https://master.php.net/note/edit/115790 Del: integrated -- https://master.php.net/note/delete/115790/integrated Del: useless -- https://master.php.net/note/delete/115790/useless Del: bad code -- https://master.php.net/note/delete/115790/bad+code Del: spam -- https://master.php.net/note/delete/115790/spam Del: non-english -- https://master.php.net/note/delete/115790/non-english Del: in docs -- https://master.php.net/note/delete/115790/in+docs Del: other reasons-- https://master.php.net/note/delete/115790 Reject -- https://master.php.net/note/reject/115790 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200512) next »