PHP determines whether a string is a palindrome string_PHP tutorial

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

This article will introduce you to an example to determine whether a string is a palindrome string. Friends who need to know more can refer to it.

 代码如下 复制代码
function ishuiwen($str){
$len=strlen($str);
$l=1;
$k=intval($len/2)+1;
for($j=0;$j<$k;$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.comtruehttp: //www.bkjia.com/PHPjc/628807.htmlTechArticleThis article will introduce you to an example to determine whether a string is a palindrome string. If you need to know more Friends can refer to it. The code is as follows Copy the code ?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
Popular Tutorials
More>
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!