PHPのget_class関数の使用例。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* See https://sidestory.pandanote.info/php_get_class.html for details. | |
*/ | |
class Hoge { | |
public function name() { | |
return get_class($this); | |
} | |
} | |
class HogeHoge extends Hoge { | |
function __constructor() { | |
parent::__constructor(); | |
} | |
} | |
$hoge = new Hoge(); | |
echo $hoge->name()."\n"; | |
$hogehoge = new HogeHoge(); | |
echo $hogehoge->name()."\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment