Php solo Números


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



Copy this code and paste it in your HTML
  1. function soloNumeros( $str ){
  2. #Funcion levantar(): http://snipplr.com/view/367/levantar-parmetro-beta-01/
  3. return eregi_replace("[^0-9]","", levantar( $str ) );
  4. }
  5. #Versi�³n sin levantar()
  6. function soloNumeros( $str ){
  7. return empty( $str ) ? false : eregi_replace("[^0-9]","", $str );
  8. }
  9. $numero = soloNumeros( 'oa09a98a..9898981.1' ) #Out 099898989811
  10.  
  11. //NEW VERSION
  12. function soloNum( $str ){
  13. return preg_replace("|[^0-9]|","", $str );
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.