Skip to content

Instantly share code, notes, and snippets.

@shadydragon
Last active July 19, 2017 01:48
Show Gist options
  • Select an option

  • Save shadydragon/605da381e0c80b795cdd23e1fb07c7d7 to your computer and use it in GitHub Desktop.

Select an option

Save shadydragon/605da381e0c80b795cdd23e1fb07c7d7 to your computer and use it in GitHub Desktop.
PHP class guide
<?php
namespace Thing;
class OtherClass {
public static function method_name() {
return 'Nyaa!~';
}
}
<?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