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

nemuroito
  • 179
  • 2
  • 2
  • 11
  • Have you tried anything? – Sougata Bose Jun 17 '15 at 05: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 – nemuroito Jun 17 '15 at 05:39

0 Answers0