Skip to content

Instantly share code, notes, and snippets.

@pandanote-info
Last active March 28, 2020 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pandanote-info/15cfcabe7ee7c0af95e31f1c60e56ad8 to your computer and use it in GitHub Desktop.
Save pandanote-info/15cfcabe7ee7c0af95e31f1c60e56ad8 to your computer and use it in GitHub Desktop.
PHPのget_class関数の使用例。
<?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