Created
April 5, 2019 15:58
-
-
Save nielslange/1f5c150ae70190e809466d7cf9c63250 to your computer and use it in GitHub Desktop.
Check if a string only contains numbers
This file contains 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 | |
if ( ctype_digit( $input ) ) { | |
echo $input . ' only contains numbers.' ); | |
} else { | |
echo $input . ' does not only contains numbers.' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment