Is it possible to have a function with two returns like this:
function test($testvar)
{
// Do something
return $var1;
return $var2;
}
<
Functions, by definition, only return one value.
However, as you assumed, that value can be an array.
So you can certainly do something like:
$a,'bar'=>$b);
}
print_r(myfunc('baz','bork'));
That said, it's worth taking a moment and thinking about whatever you're trying to solve. While returning a complex result value (like an array, or an object) is perfectly valid, if you're thinking is that "I want to return two values", you might be designing poorly. Without more detail in your question, it's hard to say, but it never hurts to stop and think twice.