fork download
  1. <?php
  2. header("Content-Type: text/plain; charset=utf-8");
  3. ?>
  4. <?php
  5.  
  6. $text = 'В российском сегменте очень';
  7.  
  8.  
  9.  
  10. $len = mb_strlen($text);
  11. $circleRadius = $len / 2.5;
  12.  
  13. $text = explode(' ', $text);
  14. $newArray = array();
  15. foreach ($text as $v) {
  16. $newArray[] = preg_split("//u", $v, null, PREG_SPLIT_NO_EMPTY);
  17.  
  18. }
  19. $txt = array();
  20. foreach ($newArray as $v) {
  21. foreach ($v as $letter) {
  22. $txt[] = $letter;
  23. }
  24. }
  25.  
  26. $probels = array();
  27. for ($i = 0; $i <= $len * 4; $i++) {
  28. for ($k = 0; $k <= $len * 4; $k++) {
  29. $probels[$i][$k] = ' ';
  30. }
  31.  
  32. }
  33.  
  34. $corners = array();
  35. $corner = number_format(360 / $len, 2);
  36. $c = $corner;
  37.  
  38.  
  39. $i = 0;
  40. foreach ($txt as $letter) {
  41.  
  42. $x = (round(cos($c * M_PI / 180) * $circleRadius) + $circleRadius) * 2;
  43. $y = round(sin($c * M_PI / 180) * $circleRadius) + $circleRadius;
  44. $probels[$y][$x] = $letter;
  45.  
  46. $c += $corner;
  47.  
  48. }
  49. foreach ($probels as $v) {
  50. foreach ($v as $val) {
  51. echo $val;
  52. }
  53. echo "\n";
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
Success #stdin #stdout 0.06s 20520KB
stdin
Standard input is empty
stdout
 
               е   о     ч   е                                                                               
           т                     н                                                                           
       н                                                                                                     
                                     ь                                                                       
   е                                                                                                         
                                                                                                             
 м                                                                                                           
                                                                                                             
                                                                                                             
г                                                                                                            
                                                                                                             
е                                                                                                            
                                           В                                                                 
                                                                                                             
 с                                                                                                           
                                         р                                                                   
   м                                                                                                         
                                     о                                                                       
       о                                                                                                     
           к                     с                                                                           
               с             с                                                                               
                   й     и