English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Class/Object function reference manual
The class_exists() function checks if the class is defined
class_exists ( $class_name [,$autoload] );
This function checks if the given class is defined. If class_name is a defined class, it returns TRUE, otherwise it returns FALSE.
Serial number | Parameters and descriptions |
---|---|
1 | class_name(Required) Class name. |
2 | autoload(Optional) Whether to call __autoload by default. |
If class_name is a defined class, it returns TRUE, otherwise it returns FALSE.
The following is the usage of this function, to check if the class HelloWorld is defined-
<?php if (class_exists('HelloWorld')) { $helloworld = new HelloWorld(); } ?>