0

I am looking for a 'reasonably fast' PHP method to find all possible permutations of specific text fragments.

Note, no need for array recursion, but an array could be big.

Example:

<?php
    $fragments [] = "al";
    $fragments [] = "ex";
    $fragments [] = "00";

    $permutations = permuteTxt($fragments);
    print_r($permutations);
?>

Result:

  • alex00
  • 00alex
  • exal00
  • al00ex
  • 00exal
  • ex00al

I would appreciate your help, and a brief explanation of your brainstorming on how you got it together.

Ruslan Abuzant
  • 631
  • 6
  • 17

0 Answers0