call_user_method
class_exists
Classes/Object Functions
PHP Manual

# class_alias

(PHP 5 >= 5.3.0, PHP 7)

class_alias — Creates an alias for a class

### Description

bool class_alias ( string `$original` , string `$alias` [, bool `$autoload` = `TRUE` ] )

Creates an alias named `alias` based on the user defined class `original`. The aliased class is exactly the same as the original class.

### Parameters

`original`

  The original class.

`alias`

  The alias name for the class.

`autoload`

  Whether to autoload if the original class is not found.

### Return Values

Returns `TRUE` on success or `FALSE` on failure.

### Examples

Example #1 class_alias() example

`<?php
class foo { }
class_alias('foo', 'bar');
$a = new foo;
$b = new bar;
// the objects are the same
var_dump($a == $b, $a === $b);
var_dump($a instanceof $b);
// the classes are the same
var_dump($a instanceof foo);
var_dump($a instanceof bar);
var_dump($b instanceof foo);
var_dump($b instanceof bar);
?>`

The above example will output:

    bool(true)
    bool(false)
    bool(true)
    bool(true)
    bool(true)
    bool(true)
    bool(true)

### See Also

- get_parent_class() - Retrieves the parent class name for object or class
- is_subclass_of() - Checks if the object has this class as one of its parents or implements it.

call_user_method
class_exists
Classes/Object Functions
PHP Manual