Web | This Site

Learning PHP
Advanced PHP
PHP Function Reference
PHP Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# PHP Function class_exists()

## Syntax

class_exists ( $class_name [,$autoload] );

## Definition and Usage

This function checks if the given class have been defined. Returns TRUE if class_name is a defined class, FALSE otherwise.

## Paramters

Parameter | Description
--- | ---
class_name | Required. The class name.
autoload | Optional. Whether to call __autoload or not by default.

## Return Value

Returns TRUE if class_name is a defined class, FALSE otherwise.

## Example

Following is the usage of this function:

    <?php
    if (class_exists('MyClass')) {
        $myclass = new MyClass();
    }
    ?>

Advertisement

Online Image Processing

Indian Baby Names