NYCPHP Meetup

NYPHP.org

[nycphp-talk] Access an element of a method that returns an ar ray

Joe Crawford jcrawford at codebowl.com
Wed Jul 21 07:59:26 EDT 2004


Scott,

thanks for this clarification that is a feature of 5 that i did not know
about yet ;)

Joe Crawford Jr.

On Wed, 2004-07-21 at 07:54, Scott Mattocks wrote:
> Joe Crawford wrote:
> 
> > i dont see this working in 4 or 5 reason being is you have to have the
> > method return the array before you can actually access the elemnets so
> > $obj->method()[3] will not work you must assign it to a variable before
> > you can access it.  
> 
> PHP 4 doesn't know what to do with this syntax but one of the changes in 
> PHP 5 is to let you use the return value of a function without assigning 
> it first.  If your function/method returns an object you can call 
> methods of that object without assigning it to a variable first.
> Ex: $obj->getOtherObj()->method();
> 
> Scott Mattocks
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 




More information about the talk mailing list