// Validate numeric input
function isnum($value, $decimal=false) {
if (!is_array($value)) {
if($decimal==true) return (preg_match("/^[0-9]+(\.{0,1})[0-9]*$/", $value));
return (preg_match("/^[0-9]+$/", $value));
} else {
return false;
}
}
^-?[0-9]+(\.{0,1})[0-9]*$
Category Forum
Code Snippet and functions - 8Labels
Statistics
2 participants
Notifications
You are not receiving notifications from this thread.
Related Questions