Home > Backend Development > PHP Tutorial > PHP self-study no00013 constant definition value to determine whether it has been defined

PHP self-study no00013 constant definition value to determine whether it has been defined

WBOY
Release: 2016-07-29 08:50:55
Original
1144 people have browsed it

<!--常量定义define(常量名,常量值,true)true表示常量名大小写一样-->
<!--取值有二种,一种直接赋值,另一种用函数constant(常量名)动态获取常量值-->
<!--函数defined(常量名)判定常量是否已定义-->
<?php error_reporting(E_ALL ^ E_NOTICE); //忽略错误
	define("zhaowanshi","myname我的名字");
	echo zhaowanshi;
	echo &#39;<br />';
	echo ZHAOWANSHI;
	echo '<br>';
	
	define("taizhou","浙江台州是我所在的地方",true);
	echo taizhou;
	echo '<br>';
	echo TAIZHOU;
	echo '<br>';
	
	$name = "TAIZHOU";
	echo constant($name);
	echo '<br>';
	echo defined("TAIZHOU");
?>
Copy after login

PHP self-study no00013 constant definition value to determine whether it has been defined

The above has introduced PHP self-study no00013 constant definition and value determination to determine whether it has been defined, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template