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

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