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