evValidFloat | checks if a given string has a valid FLOAT format


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // name: evValidFloat
  2. // version: v0.1
  3. // description: chequea que sea un float
  4.  
  5. function evValidFloat( $val ) {
  6.  
  7. if ( preg_match( '/^[0-9]+(?:\.[0-9]{2})?$/', $val ) ) return true;
  8. else return false;
  9.  
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.