PHP 8.5.0 Alpha 1 available for testing

Voting

: max(seven, nine)?
(Example: nine)

The Note You're Voting On

e dot klerks at i-bytes dot nl
14 years ago
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.

<< Back to user notes page

To Top