类中怎么调生成其它类对象

类中如何调生成其它类对象a.phpclass a(){}b.phpclass b(){}a中如何调用b类,并生成对象public $bnew b()

类中如何调生成其它类对象
a.php
class a(){}

b.php
class b(){}
a中如何调用b类,并生成对象
public $b=new b();提示Parse error: syntax error, unexpected T_NEW
[解决办法]
在 a 的方法里

class a(){
  public $b;
  function __construct() {
    $this->b = new b;
  }
}