PHP判断一个字符串是否是回文字符串_PHP教程

WBOY
Release: 2016-07-13 17:15:34
Original
879 people have browsed it

本文章给大家介绍一个实例,用来判断字符串是不是为回文字符串,有需要了解的朋友可参考参考。

代码如下 复制代码
function ishuiwen($str){
$len=strlen($str);
$l=1;
$k=intval($len/2)+1;
for($j=0;$j if (substr($str,$j,1)!=substr($str,$len-$j-1,1))
{
$l=0;
break;
}


}
if ($l==1)
{
return 1;
}
else
{
return -1;
}
}

$str=12321;
echo ishuiwen($str);
?>

www.bkjia.com true http://www.bkjia.com/PHPjc/628807.html TechArticle 本文章给大家介绍一个实例,用来判断字符串是不是为回文字符串,有需要了解的朋友可参考参考。 代码如下 复制代码 ?php function ishuiwen...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!