Issues with integer operations
<pre><code>function sendSms($toPhone,$message){
    $toPhone=intval(trim($toPhone));
    if(strlen($toPhone)== 8 &amp;&amp; $toPhone{0}==9){

                    //sending sms

    }else{
        return "error";
    }

}
</code></pre>

<p>I am trying to validate mobile numbers for sending SMS. The first line trims the phone number string and then converts it to an integer. In the <code>if</code> statement, I want to make sure that the number length is 8 digits and it begins with 9. This function always goes for the <code>else</code> even if the number is correct( 8 digits and begins with 9). What could be the issue here.</p>
