- Google+ Tools
-
Make Google+ profile picture
Make Google plus banners for profile
Create and share your Google Plus profile banners.
- This snippet allows you to check whether a number is decimal or not.
Check if a number is a decimal
//This snippet checks if a number is decimal or not
<?php
//Function that checks if a number is decimal
function validate($v) {
return(floor($v) != $v);//if the number is not a whole number then its a decimal.
}
//Example
if (validate(0.52)==true) { //if the number is a decimal then print success message
echo "Number is a decimal";
}
else { // else print failure message.
echo "Number is not a decimal";
}
?>
Comments
blog comments powered by Disqus