Tuesday, October 16, 2012

Palindrome

$a_inputString = "raddar"
function isPalindrome($a_inputString)
{
    $frontPointer = 0;
    $backPointer = str_length(inputString)-1;
   
    while ($frontPointer < $backPointer)
    {
       if ( strcmp(substr($inputString, $frontPointer, 1)
                  (substr($inputString, $backPointer, 1) == false)
           return false;
       $frontPointer ++;
       $backPointer --;
    }
   
    return true;
}

No comments:

Post a Comment