Home >Backend Development >PHP Problem >How to determine whether a class method exists in php

How to determine whether a class method exists in php

藏色散人
藏色散人Original
2020-07-04 10:02:053738browse

In PHP, you can use the "class_exists" function to determine whether a class method exists. The syntax is "bool class_exists (string $class_name [, bool $autoload = true ])".

How to determine whether a class method exists in php

php determines whether the class exists

bool class_exists ( string $class_name [, bool $autoload = true ] ) Checking whether a class has been defined must return true, otherwise false, for example:

if(class_exists('MySQL')){
    $myclass=new MySQL();
}

For more related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to determine whether a class method exists in php. For more information, please follow other related articles on the PHP Chinese website!

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