Page 1 of 1

is (( $objectA->fx('foo') )->fxBar() )[1]; possible ?

Posted: Wed Sep 02, 2009 1:12 pm
by aaaaaaaa
Hey everyone,

The problem is quite simple :)

I have that kind of functions, with objects from differents classes

$object2=$objectA->fx('foo');
$array=$object2->fxBar();
echo $array[1];

and I would like to do that :

echo (( $objectA->fx('foo') )->fxBar() )[1];

I know that it works with other languages like java, by catings objects

Re: is (( $objectA->fx('foo') )->fxBar() )[1]; possible ?

Posted: Wed Sep 02, 2009 1:17 pm
by arjan.top
you can chain method calls, but ->foo()[0] wont work

Re: is (( $objectA->fx('foo') )->fxBar() )[1]; possible ?

Posted: Thu Sep 03, 2009 3:21 am
by aaaaaaaa
thanks for the answer. Even if method chaining is really not what I want to do, your post informed me about PHP syntax.