Validating a floating value in PHP
<p>I started learning PHP to do some pet project, and I am trying to get this around my head on how to validate a valid float or double in PHP</p>

<p>Supposed I have this code in HTML that ask for interest rate</p>

<pre><code>&lt;input type="text" name="interest" size="5" &gt;
</code></pre>

<p>In My PHP code, I wanted to validate if this is a valid interest rate:</p>

<pre><code>&lt;?php       
    $interest = $_POST['interest']
    //isset - empty test (not- shown)
    if(!is_numeric($interest) &amp;&amp; is_float($interest)){
        print "&lt;p&gt;&lt;span class='error'&gt;Interest should be numeric&lt;/span&gt;&lt;/p&gt;";
    }
?&gt;
</code></pre>

<p>I have my is_numeric()  test first then I coupled it with the is_float() test but when I enter "1." (note the "." after the number) it should catch this but apparently not.  I am not sure why "1." is a valid floating variable in PHP.</p>