Last active
July 19, 2017 01:48
-
-
Save shadydragon/605da381e0c80b795cdd23e1fb07c7d7 to your computer and use it in GitHub Desktop.
PHP class guide
This file contains hidden or 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 | |
| namespace Thing; | |
| class OtherClass { | |
| public static function method_name() { | |
| return 'Nyaa!~'; | |
| } | |
| } |
This file contains hidden or 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 | |
| // contains bar class | |
| require_once('utils.php'); | |
| // contains OtherClass and namespaced as Thing | |
| require_once('filename.php'); | |
| // Class foo inherits all methods from bar | |
| class foo extends bar { | |
| public static function blah() { | |
| // Access a method in the Utils class, method_name returns something | |
| return \Thing\OtherClass::method_name(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment