Last active
December 17, 2015 11:49
-
-
Save hjpbarcelos/5605004 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 | |
/** | |
* Retorna o parâmetro POST se a chave $key existe em $_POST. | |
* Caso não esteja, o valor $default será retornado. | |
* Se nenhum valor $default for informado, retorna null. | |
* | |
* @return string|null | |
*/ | |
function getPost($key, $defalt = null) { | |
if (isset($_POST[$key]) && !empty(isset($_POST[$key]))) { | |
return $_POST[$key] ; | |
} | |
return $default === null ? null : (string) $default; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment