Posted By

pythas on 02/06/13


Tagged

validation codeigniter


Versions (?)

Is numeric


 / Published in: PHP
 

Read docblock.

  1. /**
  2.  * Form validation for numeric values (CI did not support a comma as the decimal separator)
  3.  * @param string $str
  4.  * @return boolean
  5.  */
  6. public function _is_numeric($str)
  7. {
  8. return empty($str) || preg_match('/^[0-9]*[\.\,]?[0-9]+$/', $str) == 1;
  9. }

Report this snippet  

You need to login to post a comment.