Überprüfen Sie, ob Nummern PHP enthält
if (preg_match('~[0-9]+~', $string)) {
echo 'string with numbers';
}
Realy Silly Shark
if (preg_match('~[0-9]+~', $string)) {
echo 'string with numbers';
}
$var_num = "1";
$var_str = "Hello World";
var_dump( is_numeric($var_num), is_numeric($var_str) );
/*
Output -
bool(true)
bool(false)
*/
if (preg_match('/[A-Za-z]/', $myString) && preg_match('/[0-9]/', $myString))
{
echo 'Contains at least one letter and one number';
}