fork(2) download
  1. <?php
  2.  
  3.  
  4. $text = "Аргентина манит негра";
  5. $result= "Палиндром";
  6. $result2= "Не палиндром";
  7. $text = mb_strtolower($text);
  8.  
  9. $text = str_replace(" ","",$text);
  10.  
  11. $length = mb_strlen($text);
  12. $halfLength = floor($length/2);
  13. for ($i=0; $i==$halfLength; $i++) {
  14. $o=-$i;
  15. $comparison1=mb_substr($text,$i,1);
  16. $comparison2=mb_substr($text,$o,1);
  17. if ($comparison1==$comparison2) {
  18. echo "Результат: $result";
  19. } else {
  20. echo "Результат $result2";
  21. }}
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty