Skip to content

Instantly share code, notes, and snippets.

@antoniogarcia78
Created September 16, 2015 12:18
Show Gist options
  • Save antoniogarcia78/322f0fbe863f2127beee to your computer and use it in GitHub Desktop.
Save antoniogarcia78/322f0fbe863f2127beee to your computer and use it in GitHub Desktop.
Check if a value is numeric (avoid array a null from DB)
function isNumeric($v) {
if(is_null($v)) {
return false;
}
if(is_array($v)) {
return false;
}
return is_numeric(intval($v));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment