note 100807 modified in function.empty by thiago
| From: | thiago@php.net | Date: | Mon, 08 Nov 2010 15:13:34 +0000 |
| Subject: | note 100807 modified in function.empty by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173855@lists.php.net to get a copy of this message | ||
To make an empty function, which only accepts arrays, one can use type-hinting:
<?php
// 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.
--was--
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.
http://php.net/manual/en/function.empty.php