Guest User

Untitled

a guest
Dec 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. $enc = 'UTF-8';
  2. $word = "РАЗРАБОТАТЬ";
  3. $word = preg_replace('/s+/', '', $word);
  4. $word = mb_convert_case($word, MB_CASE_TITLE, "UTF-8");
  5. $count = mb_strlen($word, $enc);
  6. $new_word = mb_substr($word, 0, ($count - 1), $enc);
  7. $new_word = $new_word . mb_strtoupper(mb_substr($word,($count - 1), 1, $enc), $enc);
  8. $randomLine = $new_word;
  9.  
  10. header('Content-Type: text/html; charset=utf-8');
  11.  
  12. AddDefaultCharset UTF-8
  13.  
  14. function mb_strrev($str){
  15. $r = '';
  16. for ($i = mb_strlen($str); $i>=0; $i--) {
  17. $r .= mb_substr($str, $i, 1);
  18. }
  19. return $r;
  20. }
  21.  
  22. function mb_ucfirst($str) {
  23. $fc = mb_strtoupper(mb_substr($str, 0, 1));
  24. return $fc.mb_substr($str, 1);
  25. }
  26.  
  27. $word = "РАЗРАБОТАТЬ";
  28. $result = mb_strrev(mb_ucfirst(mb_strrev(mb_ucfirst(mb_strtolower($word))))); // РазработатЬ
  29.  
  30. $word = "РАЗРАБОТАТЬ";
  31. $word = preg_replace('/s+/', '', $word);
  32. $word = mb_strtolower($word);
  33. $word[1] = mb_strtoupper($word[1]);
  34. $word[mb_strlen($word)-1] = mb_strtoupper($word[mb_strlen($word)-1]);
Add Comment
Please, Sign In to add comment