fork download
  1. <?php
  2. interface SomeInterface {
  3. public function someInterfaceFunction();
  4. }
  5.  
  6. trait SomeTrait {
  7. function sayHello() {
  8. echo "Hello my secret is ".static::$secret;
  9. }
  10. }
  11.  
  12. abstract class AbstractClass implements SomeInterface {
  13. use SomeTrait;
  14. }
  15.  
  16. class TestClass extends AbstractClass {
  17. static public $secret = 12345;
  18. function someInterfaceFunction(){ }
  19. }
  20. $test = new TestClass();
  21. $test->sayHello();
  22.  
  23. //https://pt.stackoverflow.com/q/157720/101
Success #stdin #stdout 0.01s 24176KB
stdin
Standard input is empty
stdout
Hello my secret is 12345