function checkStrIsLetter($str){ $letteraArr = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); $letterAArr = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," "); //字母表 $letter = array_merge($letteraArr,$letterAArr); //分割字符 $strArr = str_split($str); //循环判断 if(!empty($strArr)){ foreach($strArr as $key=>$val){ if(!in_array($val,$letter)){ return "no"; exit; } } }else{ return "no"; } return "yes"; }
原文地址:https://www.cnblogs.com/void9main/p/9591081.html
时间: 2024-10-05 07:24:15