开发者

What php version allows this?

开发者 https://www.devze.com 2023-03-23 04:36 出处:网络
$var = a_function_that_returns_a_object()->property->something; in old PHP versions you had to do this:

$var = a_function_that_returns_a_object()->property->something;

in old PHP versions you had to do this:

$obj = a_function_that_returns_a_object();
$var = $obj->property->something;

So from which PHP version does the first code work, without giving me a error ? I know that in 5.3 works bec开发者_StackOverflow社区ause I'm using it, but I want to know in what version it starts to break


Starting with PHP 5, method chaining is supported.

0

精彩评论

暂无评论...
验证码 换一张
取 消