rec - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of rec.php

  1. <?php
  2.  
  3. function rec(string $input, int $len, int $count = 1): string
  4. {
  5.     if (--$count < 0) {
  6.         return mb_substr($input, $len);
  7.     }
  8.     
  9.     $input = mb_substr($input, $len) . rec($input, $len, $count);
  10.     
  11.     return $input;
  12. }
  13.  
  14.  
  15. echo rec('datum', 2, 5);
  16.  
File Description
  • rec
  • PHP Code
  • 27 Sep-2022
  • 265 Bytes
You can Share it: