note 100807 added to function.empty
| From: | e dot klerks at i-bytes dot nl | Date: | Mon, 08 Nov 2010 14:16:09 +0000 |
| Subject: | note 100807 added to function.empty | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173848@lists.php.net to get a copy of this message | ||
To make an empty function, which only accepts arrays, one can use type-hinting:
// emptyArray :: [a] -> Bool
function emptyArray(array $xs){
return empty($xs);
}
Type hinting is a good thing to use in your code, because it makes it more easy to reason about your
code. Besides that, it automatically documents the code.
----
Server IP: 69.147.83.197
Probable Submitter: 178.224.17.144
----
Manual Page -- http://www.php.net/manual/en/function.empty.php
Edit -- https://master.php.net/note/edit/100807
Del: integrated -- https://master.php.net/note/delete/100807/integrated
Del: useless -- https://master.php.net/note/delete/100807/useless
Del: bad code -- https://master.php.net/note/delete/100807/bad+code
Del: spam -- https://master.php.net/note/delete/100807/spam
Del: non-english -- https://master.php.net/note/delete/100807/non-english
Del: in docs -- https://master.php.net/note/delete/100807/in+docs
Del: other reasons-- https://master.php.net/note/delete/100807
Reject -- https://master.php.net/note/reject/100807
Search -- https://master.php.net/manage/user-notes.php