Static methods in PHP

前端 未结 6 721
走了就别回头了
走了就别回头了 2020-12-15 04:38

Why in PHP you can access static method via instance of some class but not only via type name?

UPDATE: I\'m .net developer but i work with php developers too. Recent

6条回答
  •  执笔经年
    2020-12-15 05:11

    Class Do {
      static public function test() {
          return 0;
      }
    }
    

    use like this :

    echo Do::test();
    

提交回复
热议问题