Re: Function declaration failing on return value

From: Date: Mon, 04 Oct 2004 22:19:23 +0000
Subject: Re: Function declaration failing on return value
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-198625@lists.php.net to get a copy of this message
On Monday 04 October 2004 16:43, Matthew Sims wrote: > > Don't get too excited; this is an awfully lame newbie question. > > Too late, I'm already excited. Sorry 'bout that. > > <?php > > function square($num) > > { > > return $num * $num; > > } > > echo square(4); // outputs '16'. > > ?> > > > > <br> > > </body> > > </html> > > > function square($num) { > > $result = $num * $num; > return $result; > > } Well, under the category of "That's weird", I changed the function to: <?php function square($nn) { $res = $nn * $nn; return $res; } and it works now. Mebbe there's goofy hidden chars in the online help? Back to the drawing board. Thanks! -- Whil Moving to Linux: Freedom, Choice, Security, Opportunity http://www.hentzenwerke.com

« previous php.general (#198625) next »