Skip to content

Instantly share code, notes, and snippets.

@mpezzi
Created December 19, 2011 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpezzi/1498447 to your computer and use it in GitHub Desktop.
Save mpezzi/1498447 to your computer and use it in GitHub Desktop.
PHP Validate Contains Numbers
<?php
/**
* Validates a string containing numbers.
*
* @param $string
* A string to validate if it contains numbers.
* @return
* TRUE or FALSE if it contains numbers.
*/
function valid_contains_numbers($string) {
return preg_match('#[0-9]#', $string);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment