fork(1) download
  1. <?php
  2.  
  3. class Foo
  4. {
  5. protected $myFoo = 'Foo!';
  6.  
  7. static public function doFoo()
  8. {
  9. echo $this->myFoo;
  10. }
  11. }
  12.  
  13. class Bar
  14. {
  15. public function doFoo()
  16. {
  17. $this->myFoo = 'Bar!';
  18. Foo::doFoo();
  19. }
  20. }
  21.  
  22. $bar = new Bar();
  23. $bar->doFoo();
  24.  
  25. /*EOF*/
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Using $this when not in object context in /home/nk7A2x/prog.php on line 9