php代码中声明对象直接使用和间接使用性能上会有差距吗?
比如如下代码:
$room = RoomBusiness::instance();
$result = $room->endLive();
和如下代码:
$result = RoomBusiness::instance()->endLive();
不讨论语法上是否简洁,只从性能上分析,第二种会不会更好呢?假设 RoomBusiness::instance() 返回的是一个巨大的对象的话。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

看少侠这代码,RoomBusiness这个类应该是以单例模式写的吧,所以两种方法没区别