isPalindrome
 <?php
  function isPalindrome($s) {
        //s = "A man, a plan, a canal: Panama"
        $s= strtolower($s);
         $filtered = "";
        $len = strlen($s);
        for ($i= 0; $i<$len; $i++){
            $ascii = ord($s[$i]);
            if (($ascii>=97 && $ascii<123) ||
             ($ascii>47 && $ascii<58)){
                $filtered.=$s[$i];
                }
        }
        return $filtered == strrev($filtered);
    }
   $s = "A man, a plan, a canal: Panama";
   echo isPalindrome($s);
by Guram Azarashvili
2 years ago
PHP
Solutions
0
Pro tip: use ```triple backticks around text``` to write in code fences