PHP:class const
摘要:
const变量经常被当做常量用在php的类中,隐含的意思是这个变量是常量,不能被修改。编译器会自动检测,如果被赋值会被提示错误警告。正确实例1:<?phpclass test{ const ERRNO = 100;}echo test::ERRNO."\n";输出:100错误示范1:const常量被赋值,编译器提示错误<?phpclass test{ const ERRNO = 100;}test::ERRNO = 10;echo test::ERRNO."\n";输出:PHP Parse error: syntax error, unexp 阅读全文
posted @ 2014-03-12 18:41 awildfish 阅读(2681) 评论(0) 推荐(0) 编辑