fork download
  1. <?php
  2. class Router {
  3. public function get() {
  4. return $this;
  5. }
  6. }
  7.  
  8. class Router2 {
  9. public static function get() {
  10. return self::class;
  11. }
  12. }
  13. $x = new Router();
  14. echo $x->get();
  15. echo Router2::get();
Runtime error #stdin #stdout #stderr 0.02s 24524KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Recoverable fatal error:  Object of class Router could not be converted to string in /home/cLnmRi/prog.php on line 14