Home >Backend Development >PHP Tutorial >php常量的问题。php常量的值改变了,疑惑

php常量的问题。php常量的值改变了,疑惑

WBOY
WBOYOriginal
2016-06-02 11:34:301040browse

php

php常量的问题。php常量的值不能改变,但是一下这段代码的值有一点改变。请大家帮我分析一下。
代码如下:
define("CONSTANT", "hello!", true);
echo CONSTANT."
";
define("CONSTANT", "What are you doing?");
echo CONSTANT."
";
echo Constant;
页面输出时这样的:
hello!
What are you doing?
hello!

搞不清楚为什么第二个会输出"What are you doing?". define第一个时不设置true的话输出的是“hello”。大家有什么见解吗?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn