As¶
The as operator has several usage:
It is an optional keyword with the
foreach()control structure, to access the key of the looped arrayIt is an optional keyword with the use expression, in trait import
It is an optional keyword with the use expression, in namespace import
The as operator often works to give a distinct name to an existing structure.
<?php
use stdClass as StandardClass;
foreach($map as $key => $value) {
print "$key => $value\n";
}
?>