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

PHP functions: method_exists and function_exists_PHP tutorial

WBOY
Release: 2016-07-20 11:15:51
Original
1066 people have browsed it

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> )
Copy after login

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> )
Copy after login

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template