全部博文(921)
分类:
2006-12-05 14:37:37
php
function emailIsRight($email) {
if (preg_match("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$",$email)) {
return 1;
}
return 0;
}
if(emailIsRight('y10k@963.net\')) echo \'正确
\';
if(!emailIsRight(\'y10k@fffff\')) echo \'不正确
\';
?> ;
php
echo "Preg_replace used time:";
$start = time();
for($i=1;$i<=100000;$i++) {
$str = "ssssssssssssssssssssssssssss";
preg_replace("/s/","",$str);
}
$ended = time()-$start;
echo $ended;
echo "
ereg_replace used time:";
$start = time();
for($i=1;$i<=100000;$i++) {
$str = "ssssssssssssssssssssssssssss";
ereg_replace("s","",$str);
}
$ended = time()-$start;
echo $ended;
echo "
str_replace used time:";
$start = time();
for($i=1;$i<=100000;$i++) {
$str = "sssssssssssssssssssssssssssss";
str_replace("s","",$str);
}
$ended = time()-$start;
echo $ended;
?>