码迷,mamicode.com
首页 > Web开发 > 详细

PHP类常量的常见访问方法

时间:2014-10-08 14:20:35      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:io   strong   sp   div   c   on   cti   r   new   

 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

PHP类常量的常见访问方法

标签:io   strong   sp   div   c   on   cti   r   new   

原文地址:http://www.cnblogs.com/sheevy/p/4010661.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!