Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return from function

Status
Not open for further replies.

neilmurray

Technical User
Jan 18, 2005
32
GB
Trying to return variables from a function to teh main programme.

Using

return array($var1,$var2,$var3);

Where are these variables then stored?

I can't find them.

Thanks,

Neil.
 
How are you using the function?

If you have something like this:
Code:
function x($a,$b)
{
 $var1 = $a + $b;
 $var2 = $a - $b;
 $var3 = $a * $b;
 return array($var1, $var2, $var3);
}
//
//
$na = x(5,4);
Then then variable "$na" will be an array containing the values 9, 1, 20.

Do a
Code:
echo '<pre>';print_r($na);echo '</pre>';
to confirm that.

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top