Home  >  Article  >  Backend Development  >  php 判断恒量、变量、函数是否存在

php 判断恒量、变量、函数是否存在

WBOY
WBOYOriginal
2016-06-13 11:03:09690browse

php 判断常量、变量、函数是否存在

<?php/* 判断常量是否存在*/if (defined('CONSTANT1')) {echo CONSTANT1;}//判断变量是否存在if (isset($myvar)) {echo "$myvar.";}//判断函数是否存在if (function_exists('open')) {echo "存在函数open\n";} else {echo "函数open不存在\n";}?> 

?

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