fork(8) download
  1. <?php
  2.  
  3. $test = "А роза упала на лапу Азора";
  4. $result = "палиндром";
  5.  
  6. $test = mb_strtolower($test);
  7. $test = str_replace(" ","",$test);
  8.  
  9. $length = mb_strlen($test);
  10. $halfLength = floor($length/2);
  11. $palindrom = true;
  12. for ($i = 0; $i <= $halfLength; $i++) {
  13. if (mb_substr($test, $i, 1) !== mb_substr($test, -($i+1), 1)) {
  14. $palindrom = false;
  15. }
  16. }
  17.  
  18. if ($palindrom === false) {
  19. echo 'hui';
  20. } else {
  21. echo $result;
  22. }
  23. ?>
  24.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
палиндром