Re: Function declaration failing on return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux