fork(1) download
  1. <?php
  2.  
  3.  
  4. $text = "А роза упала на лапу Азора";
  5. $noProb = str_replace(' ','',$text);
  6. $downStr = mb_strtolower($noProb);
  7.  
  8. $length = mb_strlen($downStr);
  9. $halfLength = floor($length/2);
  10. $half1 = "";
  11.  
  12. for ($i = 0;$i <= ($halfLength);$i++){
  13. $half1 .= mb_substr($downStr ,$i,1);
  14. }
  15. $half2=strrev($half1);
  16. echo " раз'$half1' два'$half2'";
  17. if ($half1 = $half2){
  18. echo "палиндром";
  19.  
  20. }
  21. elseif($half1 != $half2){
  22. echo "не палиндром";
  23. }
  24.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
 раз'арозаупалан' два'�алапЃѰзоЀѰ�'палиндром