Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
<?php
// 常量的值不能更改;变量的值可以更改。
define("WZM","姓名的缩写");
$wzm1 = "咖啡";
echo "更改之前:".WZM;
echo "<br/>";
echo "更改之前:".$wzm1;
echo "<hr/>";
define("WZM","王之满");//更改了会报错,
$wzm1 = "咖啡王之满";
echo "更改之后:".WZM;
echo "<br/>";
echo "更改之后:".$wzm1;
// 常量,不管是否是在函数体内或函数体外,作用域是一样的。变量,作用域不一样
echo "<hr/>";
function add(){
echo "在函数体内输出常量:".WZM;
echo "<br/>";
$wzm1 = "函数体内";
echo "在函数体内输出变量:".$wzm1;
}
add();
echo "<hr/>";
echo "在函数体<span style='color:red'>外</span>输出变量:".$wzm1;
?>