Created
December 19, 2011 19:10
-
-
Save mpezzi/1498447 to your computer and use it in GitHub Desktop.
PHP Validate Contains Numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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