Skip to content

Instantly share code, notes, and snippets.

@nielslange
Created April 5, 2019 15:58
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 nielslange/1f5c150ae70190e809466d7cf9c63250 to your computer and use it in GitHub Desktop.
Save nielslange/1f5c150ae70190e809466d7cf9c63250 to your computer and use it in GitHub Desktop.
Check if a string only contains numbers
<?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