Re: return

From: Date: Mon, 01 Apr 2002 05:51:36 +0000
Subject: Re: return
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90925@lists.php.net to get a copy of this message
On Mon, 1 Apr 2002, Jordan wrote: > Isnt there really no need for the 'return' though? Try this program and see what happens: <? function triple1($x) { $x = $x * 3; return $x; } function triple2($x) { $x = $x * 3; } function triple3($x) { global $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); ?> miguel

« previous php.general (#90925) next »