# Change to function call semantics in PHP 5.1?

- Thread: https://externals.io/message/21975
- Original archive: https://news-web.php.net/php.internals/21975
- Started by Mark Spruiell on 2006-02-21T22:25:26+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #21975 — Mark Spruiell — 2006-02-21T22:25:26+00:00

URL: https://externals.io/message/21975#21975

In PHP 5.0.x, I can chain function calls like this:

$obj->method()->anotherMethod();

In PHP 5.1.x, this code results in an error:

parse error, unexpected `T_OBJECT_OPERATOR` in ...

I've looked through the change log for 5.1 but didn't see
anything relevant.

Was this an intentional change?

Thanks,
- Mark

---

## #21976 — Michael Wallner — 2006-02-21T22:41:55+00:00

URL: https://externals.io/message/21975#21976 · In reply to: #21975

Mark Spruiell wrote:
> In PHP 5.0.x, I can chain function calls like this:
> 
> $obj->method()->anotherMethod();
> 
> In PHP 5.1.x, this code results in an error:
> 
> parse error, unexpected `T_OBJECT_OPERATOR` in ...
> 
> I've looked through the change log for 5.1 but didn't see
> anything relevant.
> 
> Was this an intentional change?

What version did you try?  It seems to still work fine with current CVS.

Regards,
-- 
Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz

---

## #21977 — jome — 2006-02-21T22:48:37+00:00

URL: https://externals.io/message/21975#21977 · In reply to: #21975

Mark Spruiell skrev:
> In PHP 5.0.x, I can chain function calls like this:
> 
> $obj->method()->anotherMethod();
> 
> In PHP 5.1.x, this code results in an error:
> 
> parse error, unexpected `T_OBJECT_OPERATOR` in ...
> 
> I've looked through the change log for 5.1 but didn't see
> anything relevant.

jome@thisbe:~$ php -r 'class a { function b() { return new B; } } class 
B { function C() { echo "Works fine."; } } $a = new A; $a->b()->c();'
Works fine.

jome@thisbe:~$ php -v
PHP 5.1.1 (cli) (built: Jan  7 2006 21:44:30)

The error is somewhere in your code.

/j

---

## #21979 — Mark Spruiell — 2006-02-21T23:22:10+00:00

URL: https://externals.io/message/21975#21979 · In reply to: #21976

> Mark Spruiell wrote:
> > […]
>
> What version did you try?  It seems to still work fine with current CVS.

Sorry, false alarm. I thought I had 5.1.2 in my path, but
it was actually 4.x.

- Mark
