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