Created
September 16, 2015 12:18
-
-
Save antoniogarcia78/322f0fbe863f2127beee to your computer and use it in GitHub Desktop.
Check if a value is numeric (avoid array a null from DB)
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
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