Home > Backend Development > PHP Tutorial > 2——PHP defined函数 ill defined be defined by already defined

2——PHP defined函数 ill defined be defined by already defined

WBOY
Release: 2016-07-29 08:48:48
Original
1203 people have browsed it

The

*/
 * Copyright (c) 2016,烟台大学计算机与控制工程学院
 * All rights reserved.
 * 文件名:text.cpp
 * 作者:常轩
 * 微信公众号:Worldhello
 * 完成日期:2016年5月18日
 * 版本号:V1.0
 * 问题描述:PHP
 * 程序输入:无
 * 程序输出:无
 */
<?php 
define("PI1",3.14);
$p = "PI1";
$is1 = defined($p);
$is2 = defined("PI2");
var_dump($is1);
var_dump($is2);
?>
Copy after login

defined() function can help us determine whether a constant has been defined. Its syntax format is:

bool defined(string constants_name

If it exists, it returns Boolean type true, otherwise it returns Boolean type false; (Note :bool indicates that the function return value type is Boolean)

The above has introduced 2-PHP defined function, including the defined 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