[Solved] How can we return multiple value from one function? [closed]


You can return an array,

function doSth(){
    $a = 2;
    $b = 5
    $c = 9;
    return array($a, $b, $c);
}

and then use the list() method to get back single values:

list($a, $b, $c) = doSth();
echo $a; echo $b; echo $c;

2

solved How can we return multiple value from one function? [closed]