On Sun, 31 Mar 2002, Miguel Cruz wrote: > On Mon, 1 Apr 2002, Jordan wrote: >> Isnt there really no need for the 'return' though? > > Try this program and see what happens:
Ah, Rasmus brings up a good point. Try this one instead. <? function triple1($x) { $x = $x * 3; return $x; } function triple2($x) { $x = $x * 3; } function triple3($x) { global $x; $x = $x * 3; } function triple4(&$x) { $x = $x * 3; } $x = 5; $x = triple1($x) print '<p>triple1: ' . $x; $x = 5; print '<p>triple1 return: ' . triple1($x); $x = 5; $x = triple2($x) print '<p>triple2: ' . $x; $x = 5; print '<p>triple2 return: ' . triple2($x); $x = 5; $x = triple3($x) print '<p>triple3: ' . $x; $x = 5; print '<p>triple3 return: ' . triple3($x); $x = 5; $x = triple4($x) print '<p>triple4: ' . $x; $x = 5; print '<p>triple4 return: ' . triple4($x); ?> miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php