Created
April 18, 2013 22:44
-
-
Save edinella/5416824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function verificadorDe($tipo){ | |
return function($var) use($tipo) { | |
return gettype($var) == $tipo; | |
} | |
} | |
$verificaInteiro = verificadorDe('integer'); | |
$verificaTexto = verificadorDe('string'); | |
$ok = $verificaInteiro(1); // true | |
$ok = $verificaInteiro('1'); // false | |
$ok = $verificaTexto('abc'); // true | |
$ok = $verificaTexto(array()); // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment