0

I've tried a lot of the suggested answers on StackOverflow but all of them doesn't make the first digit appears on the next digit

$arr = array('1','2','3','4','5');

How to get all possible permutation when I call it with N digits?

permutation($arr, 4);

Expected output for 4 digits:

1234
1235
1324
1325
1423
1425
1435
2134
2135
2143
2145
2154
2153
... and so on

Please pay an attention that I want previous digit still appearing on the next digit

2
  • Have you tried anything? Commented Jun 17, 2015 at 5:37
  • @Uchiha the problem of that answer is the first digit doesn't appear anymore on the next digit, as you can see the answer : 12345 12346 12347 12356 12357 12367 12456 12457 12467 12567 13456 13457 13467 13567 14567 23456 23457 23467 23567 24567 34567 Commented Jun 17, 2015 at 5:39

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.