RE: [PHP] php programming style
| From: | Ernest E Vogelsinger | Date: | Thu, 21 Nov 2002 19:21:39 +0000 |
| Subject: | RE: [PHP] php programming style | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125467@lists.php.net to get a copy of this message | ||
At 19:54 21.11.2002, Beau Hartshorne said:
--------------------[snip]--------------------
>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:
--------------------[snip]--------------------
I also have the habit of always having my functions returning a comparable
type. Comparable means you can always use the empty(), isset(), or count()
functions with correct result.
This said I'd suggest to return <<null>> for non-void functions in case of
failure.
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/