> 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)...

I agree that it should return a consistent type. I was planning on
returning a populated array on success, or a boolean false on fail.
Instead, I will return an empty (but initialized) array on fail, and use
the count() function to test for failure like this:


function foo()
        /* if the result set is empty */
        return array();

$my_array = foo();

if (count($my_array) <= 0) {
        // nothing in array
        echo 'nothing';
} else {
        // do something with data
        echo 'something';



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

Reply via email to