验证只接受浮点数,但它也接受整数,在PHP?

In the form the user needs to enter two values. These values should only float numbers. I have searched how to validate to input float values, and the way I did it, it accepts integers. I used the filter_var() function with the FILTER_VALIDATE_FLOAT . It accepts successfully the float scores, but it also accepts the integers which I don't want it.

savelibscores.php

<?php

 define('DB_NAME','');
 define('DB_USER','');
 define('DB_PASSWORD','');
 define('DB_HOST','localhost');

 $connect = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);

 if(!$connect){
    die('Could not connect:'.mysql_error());
 }

 $db_selected=mysql_select_db(DB_NAME,$connect);

 if(!$db_selected){
    die('Can\'t use'.DB_NAME.':'.mysql_error());
 }

if(isset($_POST['submit'])){

$value1=$_POST['s3'];
$value2=$_POST['s4'];
$value3=$_POST['year'];


if(filter_var($value1,FILTER_VALIDATE_FLOAT) && filter_var($value2,FILTER_VALIDATE_FLOAT)) {
    echo 'TRUE.';

} else {
    echo 'FALSE.';
}

if(!empty($value1) && !empty($value2) && !empty($value3)){
    $sql=mysql_query("INSERT INTO `library`(s3,s4,year) VALUES ('".$value1."','".$value2."','".$value3."')")or die(mysql_error());
}
else{
    echo "Please fill all the fields. Please be sure to use float values also.";
}


}
?>

Floats are a superset of integers, and as a float input, "3" is just as valid as "3.14159", even though 3 also so just happens to be a valid integer as well.

Would you rather force people to enter "3.0" instead of "3"? The resulting float value will be exactly the same, and you're only making it less convenient for your users.

Validating to accept only float numbers

UPDATE

$value1 = "23.5";

if (is_numeric($value1))
{   
    if (strpos($value1, ".") !== false)
    {
        echo 'TRUE';  //float
    } else {
        echo 'FALSE';  //integer
    }
}

is_float($number) will let you know if the $number is a float or not. (23 returns false).

If you don't want to accept numbers like 23.0 then:

function isDecimal($number)
{
  if(is_numeric($number) and floor($number)!==$number)
    return true;

  return false;
}