PHP - Detecting palindromes example - not production grade. 
<?php

function isPalindrome($string=null)
{
if($string === null)
return 0;

if(is_numeric($string))
return 0;

$string = preg_replace('/\s+/', '', $string);

$reverse = strrev($string);

if($reverse == $string)
return 1;
else
return 0;

}

echo isPalindrome('lion oil');


[ view entry ] ( 1523 views )   |  print article

<<First <Back | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Next> Last>>


2025 By Angel Cool