Returning multiple value from a function
Usually Function returns a single return value to the caller. But in some case we need more than one value to be returned for our convenience.
This can be achieved by
1. Return value as an array
2. Concating the value in a string and splitting.
<?php
function user_process() {
$value[][’name’] = “First name”;
$value[][’age’] = 23;
$value[][’sex’] = ‘male’;
return $value;
}
$user = user_process();
echo “Name: “.$value[0][’name’].”, Age:”.$value[0][’age’].”, Sex:”.$value[0][’name’];
?>
