Hi Faisal,
> Is it possible to return multiple values in a function.
> For instance, i want to do something like this:
>
> function calculate_money($sum)
> {
> // some hanky panky calculations
> return $type;
> return $amount;
> }
You have to return the values in an array, and use list() to break them up.
Try this:
function calculate_money($sum)
{
// do stuff
return array($type, $amount);
}
list($type, $amount) = calculate_money($whatever);
Cheers
Jon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php