fork download
  1. <?php
  2.  
  3.  
  4. $text = "А роза упала на лапу Азора";
  5. /* $text = "Я иду с мечем судия";*/
  6.  
  7. $text = str_replace(" ", "", $text);
  8. $text = mb_strtolower($text);
  9.  
  10. for ($i = 0; $i <= mb_strlen($text); $i++) {
  11. $symbol1 = mb_substr($text, $i, 1);
  12. $symbol2 = mb_substr($text, -$i, 1);
  13. if ($symbol1 <> $symbol2) {
  14. echo "Это не палиндром\n";
  15. $fake = true;
  16. break;
  17. }
  18. }
  19.  
  20. if ($fake <> true) {
  21. echo "Это палиндром\n";
  22. }
  23.  
Runtime error #stdin #stdout #stderr 0.01s 82880KB
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/rcaV9R/prog.php:4
Stack trace:
#0 {main}
  thrown in /home/rcaV9R/prog.php on line 4