PHP Returning Multiple Values

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Lets say I have a simple function that queries a database for 4 values. If i want to return these four values for use on a page is the most efficient way to return these values as an array and use the list function? E.g

PHP:
function ocuk(1) {
//do database stuff
return array($1, $2, $3, $4);
}

//then on the actual page where IO need these vars
list($1, $2, $3, $4) = ocuk(1);

//etc.
Ta
 
Last edited:
Back
Top Bottom