<?php
function checkUsername($username)
{
$length = mb_strlen($username, 'UTF-8');
if ($length < 3 or $length > 18) {
$message = "不满足注册条件,用户名应该为3-18位";
} else {
$message = "满足注册条件,可以注册";
return $message;
}
}
$username1 = '明';
$username2 = '明日MR';
$result1 = checkUsername($username1);
$result2 = checkUsername($username2);
echo $username1.$result1;
echo "<br>";
echo $username2.$result2;