NYCPHP Meetup

NYPHP.org

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

Joe Crawford jcrawford at codebowl.com
Tue Jul 20 21:59:34 EDT 2004


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.  

i may be wrong but i think i am right, someone correct me if i am wrong
;)

Joe Crawford Jr.


On Tue, 2004-07-20 at 18:47, Fan, Wellington wrote:
> Sorry; should have mentioned it's PHP 4.3.4
> 
> > >
> > > echo $myObject->littlePieces()[3];
> > > echo ($myObject->littlePieces())[3];
> > 
> > Is this PHP 4 or PHP 5. I'm not surprised if it doesn't work in PHP
> > 4. I think that should work in PHP 5, but I wouldn't swear to it.
> > 
> > -adam
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 




More information about the talk mailing list