> Some function return NULL some return FALSE and some return > either FALSE or NULL in case of an error.
And some return -1, some iirc return 0. I believe this is because PHP is open source and developers provide return values based on their personal preferences. But I'm not a php-dev guy so am not fully sure on the specifics or the history associated with this phenomena. Each function is documented on what it returns. If it isn't, we add such documentation. Most functions return false on failure, not all. As long as 0 isn't expected, using != to compare is often what people do. People only use strict !== when they are 100% sure what it'll return. > Some function use NULL to tell there was a parser error and FALSE for > other errors. If so one cannot do something like: > if (xxx() !== false) ... > or > if (!is_null(xxx())) ... > instead you would have to use > if (($res = xxx() !== false) && !is_null($res)) ... If that's how the function behaves and is documented then so be it. I too find it a little confusing having functions return -1, 0, false or null but that's the way it is right now. Maybe this has been addressed? > I posted the full thing already here. That also contains an analysis of > some function documentations: > http://marc.theaimsgroup.com/?l=php-dev&m=103376370906751&w=2 That looks interesting and until such a rapid change happens, or a decision is made to use your doc method, we should continue to document functions in a consistent manner which means not including the failed return value in the proto. Regards, Philip Olson -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php