Below is a simple Function to check whether the given number is decimal or not.
function check_decimal($dec_val, $decimals = 2)
{
$pattern
= "/^[-]*[0-9][0-9]*\.[0-9]{".$decimals."}$/";
if
(preg_match($pattern, $dec_val))
return
true;
else
return
false;
}
No comments:
Post a Comment