(I don't think my question is clear enough to explain my needs. Apologize for my English for that.)
I want to shuffle the number to the last possibility. I can only think of this. It seems working but it's not give me all the number as a loop runs.
$num="123";//given number
for($i=0;$i<10;$i++){
$num2[$i]=str_shuffle($num);
}//for
print_r($num2);
print_r(array_unique($num2));
As a result.
print_r($tod);//Array ( [0] => 132 [1] => 123 [2] => 321 [3] => 231 [4] => 312 [5] => 231
[6] => 231 [7] => 231 [8] => 312 [9] => 312 )
And I want only the unique array. So I put array_unique()
. Then I got...
print_r(array_unique($tod));//Array ( [0] => 132 [1] => 123 [2] => 321 [3] => 231 [4] => 312 )
I want the loop (or not) to give me all possible number from the $num
everytime. Or is there any function/method to get me this result more accurate?
As you see $num="123". I expect the result are 123, 132, 213, 231, 321 and 312.