Skip to content

Instantly share code, notes, and snippets.

@EricMcWinNer
Created July 26, 2021 00:36
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 EricMcWinNer/3263c87545e7d616d141aff9fa8f5a2c to your computer and use it in GitHub Desktop.
Save EricMcWinNer/3263c87545e7d616d141aff9fa8f5a2c to your computer and use it in GitHub Desktop.
<?php
class A {
public function staticMethod() {
echo get_class($this);
}
public function otherStaticMethod() {
self::staticMethod(); // This runs nicely. We can use self:: to access static methods from other static methods.
}
}
$a = new A();
$a->otherStaticMethod(); // A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment