How does php determine whether a constant has been defined?

Source: Internet
Author: User
Tags smarty template

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.