class_alias

Creates an alias for a class

Syntax

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

Parameters

original

The original class.

alias

The alias name for the class.

autoload

Whether to autoload if the original class is not found.

Return

Returns TRUE on success or FALSE on failure.

Examples

1 · original alias

<?

class myclass1
{
}

$original = "myclass1";
$alias = "myclass2";

$return = class_alias($original, $alias);

var_export($return);

?>
true

2 · autoload

<?

class myclass1
{
}

$original = "myclass1";
$alias = "myclass2";
$autoload = false;

$return = class_alias($original, $alias, $autoload);

var_export($return);

?>
true

class_exists

get_called_class

get_class

get_class_methods

get_class_vars

get_declared_classes

get_declared_interfaces

get_declared_traits

get_object_vars

get_parent_class

interface_exists

is_a

is_subclass_of

method_exists

property_exists

trait_exists

PHP

Home Menu