Skip to content

Instantly share code, notes, and snippets.

@INDIAN2020
Created January 21, 2020 17:52
Show Gist options
  • Save INDIAN2020/a8058faa64f4a7d7adc8be6f6587eb24 to your computer and use it in GitHub Desktop.
Save INDIAN2020/a8058faa64f4a7d7adc8be6f6587eb24 to your computer and use it in GitHub Desktop.
class ParentClass {
function test() {
self::which(); // output 'parent'
$this->which(); // output 'child'
}
function which() {
echo 'parent';
}
}
class ChildClass extends ParentClass {
function which() {
echo 'child';
}
}
$obj = new ChildClass();
$obj->test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment