How to determine whether a php constant has been defined, suddenly confused, dizzy, specially checked the manual, the record filing summary results are as follows:
(1) determine whether a constant exists
If (defined ('myconstant') {echo MYCONSTANT ;}
(2) determine whether a variable is defined
If (isset ($ myvar) {echo "variable $ myvar .";}
(3) determine whether a function exists
If (function_exists ('imap _ open') {echo "function imag_open";} else {echo "function imag_open does not exist ";}
Articles you may be interested in
- Js determines whether a variable is defined
- Common methods for determining variable types in php
- Php determines whether the string is full of English, pure Chinese, and a combination of Chinese and English
- Use php functions in the smarty template and how to use multiple functions for a variable in the smarty Template
- Javascript determines whether the mouse is left or right-click-compatible with ie, firefox, chrome, and other major browsers
- Common PHP variable judgment Functions
- Jquery checks whether the page has been loaded with the jquery File
- PHP is the safest and most practical solution to determine the type of uploaded files