PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

more php nesting intended?

Asked 2010-03-10 07:49:13 by dadada

sf: a static function that returns an array
cref : a class reference

in php i can

$v=cref::sf(param);
echo $v[0];
but i want to include an index
echo cref::sf(param)[0]//doesnt work

Anwered 2010-03-10 08:04:39 by joe.attaboy

I doubt this would work no matter what, because you can't reference an indexed value of an array that hasn't been determined. You're asking to index a static method to which you're passing a paramater. As the poster above me stated, you have to have a reference or variable that holds the value of that method. You can't index something that hasn't been determined yet.

Anwered 2010-03-10 07:55:26 by Andres

I may be wrong but you may have to continue using the variable

check out php.net, see what they have to say about it

Questions and answers provided by the Yahoo Answers Community.