Created
July 26, 2021 00:36
-
-
Save EricMcWinNer/3263c87545e7d616d141aff9fa8f5a2c to your computer and use it in GitHub Desktop.
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 | |
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