Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Alias

An alias is a distinct name for an existing named structure. It is a classic way to cope with possible naming conflict, and improve readability.

For example, there are aliases in namespaces import, to disambiguate classes, traits, interfaces, enums, functions and constants from other namespaces. There is also the class_alias() function, which allows the application-wide creation of aliases.

There are also aliases for methods, when importing them from a trait.

References are also considered an alias, as they stand for a variable with another name.

<?php

    use stdClass as StandardClass;
    
    foreach($map as $key => $value) {
        print "$key => $value\n";
    }

?>

Documentation

See Also