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:


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,


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

Reply via email to