Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php
  2. $n = $_REQUEST['maara'];
  3. $suunta = $_REQUEST['suunta'];
  4. $sana = $_REQUEST['sana'];
  5. $l = strlen($sana);
  6.  
  7. if ($suunta == "V") {
  8.     for($a = 1; $a <= $n; $a++) {
  9.         $x = substr($sana, 0, 1);
  10.         $y = substr($sana, 1);
  11.         $sana = $y.$x;
  12.     }
  13. } else {
  14.     for ($a = 1; $a <= $n; $a++) {
  15.         $x = substr($sana, $l-1);
  16.         $y = substr($sana, 0, ($l-1));
  17.         $sana = $x.$y;
  18.     }
  19. }
  20.  
  21. echo $sana;
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement