Well... Definitly depends on what kind of function it is... However, instead
of echoing in a function, most ppl recommend echo do_it(), were do_it() is
function do_it()
{
return "Hi";
}

There are many builtin functions without a return value, simply cause they
don't need to, or there's no real logic in doing so... If you have a
function named something like output_fmt($str), which is only meant to
format a string and output it, there might not need a return value... Maybe
the output itself, but you get the idea.. Some things just doesn't make
sense to return... And some things might return to a parameter... Right now
I can't think of an example though..
-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Shawn McKenzie" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Maybe a dumb question, but as good coding practice, should all functions
> return something even if they don't need to???
>
> Example:
>
> function do_it()
> {
>    echo "hi";
> }
>
> --or--
>
> function do_it()
> {
>    return echo "hi";
> }
>
> Also, if they do other things but really don't return anything, should
they
> return true maybe???
>
> Just curious!
> -Shawn

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

Reply via email to