Is it possible to have a function with two returns like this:
function test($testvar)
{
// Do something
return $var1;
return $var2;
}
<
I know that I am pretty late, but there is a nice and simple solution for this problem.
It's possible to return multiple values at once using destructuring.
function test()
{
return [ 'model' => 'someValue' , 'data' => 'someothervalue'];
}
Now you can use this
$result = test();
extract($result);
extract
creates a variable for each member in the array, named after that member. You can therefore now access $model
and $data