开发者

How can I check if the text contains at least one A to Z letter?

How can I write this in PHP?

if ($text contains 开发者_如何学Pythonat least one letter from A to Z, regardless of numbers or other characters)
    echo 'Yes';
else
    echo 'No';

Please help.


Here's something that will help

preg_match("/[a-z]/i",$text);


Like this

if (preg_match('/[A-Za-z]/i', $variable)) {

      echo 'Yes';
}
else {

      echo 'No';
}


Use preg_match() function

if (preg_match('/[a-z]/i', $text))
    echo "Matches";
else
    echo "No matches";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜