If we have a function and we want to return multiple values from that function then we can easily return an array from function.Below is the example which returns a multiple array from function.
function myFunc( ) {
$myvar1 = 10;
$myvar2 = 20;
return array($myvar1, $myvar2);
}
Another option is to retrieving values returned from function.
$results = myFunc();
echo $results[0];
echo $results[1];
0 Comment(s)