fork(1) download
  1. <?php
  2.  
  3. $text = "Абвгг вба";
  4. $text = mb_strtolower($text);
  5. $text = str_replace(" ", "", $text);
  6. $lenght = mb_strlen($text);
  7. $halfLenght = floor($lenght/2);
  8. $numberOfMismatches = 0;
  9. $text = " " . $text;
  10. for ($i=1; $i<=$halfLenght; $i++) {
  11. if (mb_substr($text, $i, 1) != mb_substr($text, -$i, 1)) {
  12. $numberOfMismatches++;
  13. }
  14. }
  15. if ($numberOfMismatches > 0) {
  16. echo "Это не палиндром.";
  17. } else {
  18. echo "Да, палиндром.";
  19. }
Runtime error #stdin #stdout #stderr 0.03s 82560KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught Error: Call to undefined function mb_internal_encoding() in /home/tCBx0Y/prog.php:4
Stack trace:
#0 {main}
  thrown in /home/tCBx0Y/prog.php on line 4