Php check function function_exists_PHP tutorial

Source: Internet
Author: User
Php checks whether the function function_exists exists. Php checks whether function function_exists syntax boolfunction_exists (string $ function_name) checks the list of defined functions, both built-in (internal) and user-defined, checks for php whether the function has a list of defined functions checked by the function function_exists (string $ function_name) syntax bool function_exists. the built-in (internal) and user-defined functions are function_name. Return value

Php Tutorial: Check whether the function function_exists exists
Syntax
Bool function_exists (string $ function_name)
Check the list of defined functions. both built-in and user-defined functions are function_name.
Return value

Returns true. if function_name exists, it is a function. otherwise, false is returned.
*/

If (function_exists ('imap _ open ')){
Echo "imap functions are available.www.bkjia.com
N ";
} Else {
Echo "imap functions are not available.
N ";
}


// Function_exists returns false on null and empty string:

If (function_exists ('')){
Echo "empty string function existsn ";
}

If (function_exists (null )){
Echo "null function existsn ";
}

// If you use suhosin.exe cutor. func. blacklist instead of in your php. ini disabled_functions, function_exists returns true as the function. This is the same as suhosin.exe cutor. func. blacklist and disabled_functions beahviur:

Function suhosin_function_exists ($ func ){
If (extension_loaded ('suhosin ')){
$ Suhosin = @ ini_get ("suhosin.exe cutor. func. blacklist ");
If (empty ($ suhosin) = false ){
$ Suhosin = explode (',', $ suhosin );
$ Suhosin = array_map ('trim', $ suhosin );
$ Suhosin = array_map ('strtolower ', $ suhosin );
Return (function_exists ($ func) = true & array_search ($ func, $ suhosin) = false );
}
}
Return function_exists ($ func );
}


Define function_exists syntax bool function_exists (string $ function_name) checks the list of defined functions, both built-in (internal) and user-defined,...

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.