Page 1 of 1

Function with list()

Posted: Wed Jun 08, 2005 12:32 am
by Pineriver
Hello,
How would I do, or is it possible to go

Code: Select all

function foo($in){
return list($aval,$bval,$cval,$dval)=explode("-",  $in  );
}

foo("a-b-c-d");
then it would return the vars of list(), avar bvar cvar dvar.

Would this be possible to return all of these variables from a function?
thanks

Posted: Wed Jun 08, 2005 2:30 am
by Syranide
you cannot return "variables" only values...
my suggested approach is returning an array with keys and values, which can if liked be "extracted" or what it's called, making all the keys become "variables".