Home  >  Article  >  Backend Development  >  PHP functions: method_exists and function_exists_PHP tutorial

PHP functions: method_exists and function_exists_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:15:511028browse

method_exists

Check whether the class method exists

<span 1</span> bool <span method_exists</span> ( <span mixed</span> <span $object</span> , <span string</span> <span $method_name</span> )

Check whether the method of the class exists in the specified object

Parameters:

object: object example or class name

method_name: method name

Return value:

If the method pointed by method_name has been defined in the object class pointed by object, return TRUE, otherwise return FALSE.

Note:

If this class is not a known class, using this function will use any registered autoloader.

function_exists

If the provided method has been defined, return TRUE.

<span 1</span> bool <span function_exists</span> ( <span string</span> <span $function_name</span> )

Check the list of defined methods, both built-in (inside PHP) and user-defined.

Parameters:

Method name, string type.

Return value:

When the method name exists and is a method, return TRUE, otherwise return FALSE.

note:

This function will return FALSE for constructs, such as include_once and echo.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440152.htmlTechArticlemethod_exists Check whether the method of the class exists bool (,) Check whether the method of the class exists in the specified object Parameters: object: object example or class name method_name: method name return value...
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