在PHP中,是否可以创建接口别名而不是类别名?

OK, this is an extremely easy question to answer, but I'm just asking it because the PHP documentation does not specify the answer, and this answer could help someone googling around for this information.

My question is, in PHP, is it possible to set up an interface alias as opposed to a class alias?

Yes, of course it's possible. The following code demonstrates this:

interface A {

  public function foo();

}

class_alias('A', 'B');

class FooB implements B {

  public function foo() {

    echo "Hello B.
";

  }

}

$fooB = new FooB();
$fooB->foo();

OUTPUT (for 5.3.0 - 5.6.5, php7@20140507 - 20150201):

Hello B.

Other versions are broken.