fork(4) download
  1. <?php
  2.  
  3. $name = "vik";
  4.  
  5. $letters = preg_split('//u', $name, -1, PREG_SPLIT_NO_EMPTY);
  6.  
  7.  
  8. function ano($found, $letters) {
  9. if (empty($letters)) {
  10. echo $found . "\n";
  11.  
  12. } else {
  13. foreach ($letters as $num => $letter) {
  14. $found .= $letter;
  15. //echo $letters[$num] . "\n";
  16. unset($letters[$num]);
  17. //print_r($letters);
  18. ano($found, $letters);
  19. }
  20. }
  21.  
  22. }
  23. $here = "";
  24.  
  25. ano ($here, $letters);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
vik
vik
vik
vik