It depends on many issues...do you have a set standard that you use when
programming.

1. does it make sense to do it that way.
2. are there performance issue
3. is it understandable for maintenance by yourself or others.
4. does the function require a return value, if so which type.


I think that some of the above question might help you out. However,
from a programming standpoint i like to make sure that my functions
return the same type at least.  Some feel different about this and
return various type (ie, int, strings, arrays)...

HTH


On Thu, 2002-11-21 at 10:57, Beau Hartshorne wrote:
> Hi,
> 
> I'm curious if it's bad coding style for a function to return a value on
> success, or simply "false" on fail. Here's what I mean:
> 
> <?php
> 
> function foo($number)
> {
>       if (is_numeric($number)) {
>               return $number . ' is a number.';
>       } else {
>               return false;
>       }
> }
> 
> if ($string = foo(1)) {
>       echo $string;
> } else {
>       echo 'error';
> }
> 
> ?>
> 
> Is this ok?
> 
> Thank you,
> 
> Beau
-- 

Ray Hunter
email:  [EMAIL PROTECTED]
www:    http://venticon.com


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

Reply via email to