downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

class_exists> <call_user_method
Last updated: Fri, 11 Dec 2009

view this page in

class_alias

(No version information available, might only be in SVN)

class_aliasCreates an alias for a class

Description

boolean class_alias ([ string $original [, string $alias ]] )

Creates an alias named alias base on the 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.

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



add a note add a note User Contributed Notes
class_alias
There are no user contributed notes for this page.

class_exists> <call_user_method
Last updated: Fri, 11 Dec 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites