PHP类常量的常见访问方法

 PHP类常量的常见访问方法

class Math {
   const num=3.14;
   
   public function showNum(){
       return self::num;
   }
}

echo Math::num."<br/>";

$math=new Math();
echo $math->showNum();

结果:
3.14
3.14

posted @ 2014-10-08 10:46  sheevy  阅读(1743)  评论(0编辑  收藏  举报
无觅相关文章插件,快速提升流量