PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Glycerine
Forum Commoner
Posts: 39 Joined: Wed May 07, 2008 2:11 pm
Post
by Glycerine » Tue Sep 23, 2008 3:29 am
U have a function of which returns an array - simple enough.
Is there a way to reference it by simply:
Thanks in advance.
shaneiadt
Forum Newbie
Posts: 10 Joined: Sat Mar 15, 2008 9:26 pm
Post
by shaneiadt » Tue Sep 23, 2008 4:13 am
Nope you can't do this!! Just assign the returned array to an array variable;
Code: Select all
$myarray = someFunc();
$myvar = $myarray[0];
Then you can use $myvar variable as normal;
echo $myvar;
or whatever valid way you want to do it
Glycerine
Forum Commoner
Posts: 39 Joined: Wed May 07, 2008 2:11 pm
Post
by Glycerine » Sat Sep 27, 2008 2:44 pm
cool. I thought as much. I was just trying to find a prettier way to reference an array return from a function