Bootstrap

PHP常量的定义以及使用

//define("变量名",值,是否模糊大小写)
define("MESSAGE","just once");
echo MESSAGE."\n";
echo Message."\n";

define("COUNT","many times",true);
echo COUNT."\n";
echo CoUnT."\n";
$name = "count";

//通过constant()函数获取常量
echo constant($name)."\n";

//是否存在常量 "MESSAGE"
echo (defined("MESSAGE"))."\n";

/*
 * PHP预定义常量部分
 *
 */
echo "\nPHP程序文件名:".__FILE__;
echo "\nPHP程序行数:".__LINE__;
echo "\nPHP程序的版本:".PHP_VERSION;
echo "\n执行PHP的操作系统名:".PHP_OS;

;