fork download
  1. <?php
  2. $text = "поп";
  3. echo $text;
  4.  
  5. $text = str_replace(" ","",$text);
  6. $text = mb_strtolower($text);
  7.  
  8. $lenght = mb_strlen($text);
  9. $i = 0;
  10. $b = 0;
  11. while (mb_substr($text, $i, 1) == mb_substr($text, -$i -2, 1)){
  12. $i++;
  13. $b++;
  14. }
  15. if ($b == $lenght - 1){
  16. echo "Палиндром!";
  17. }
  18. else{
  19. echo "Не палиндром!";
  20. }
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
попНе палиндром!