Jump to content

3 chars with permu


Alicia

Recommended Posts

Hi

 

I would like ask is how can I actually generate the result as below :

 

From 4 digits to 3 digits permuted numbers

e.g : 1234 (user enter this)

 

Generated numbers :

123

124

134

234

...

 

What we want is use the number posted by user, and we will use the number to arrange to 3 digit numbers in any possible ways as above. Repeated permuted numbers will only display once. Please advise.

 

Thank you.

 

Link to comment
https://forums.phpfreaks.com/topic/189889-3-chars-with-permu/
Share on other sites

Where you call the function you have: function($this_is_the_number_string, X_is the length of the integer returned).

 

If you modify the output pushes just the numbers into the array you can then do an array_unique on it and then whatever you want with the array.

 

At the start of the script

$str='1234';

 

at the bottom

$Array=permutations("$str",3);

 

Try it, you'll like it.

 

 

HTH

Teamatomic

Link to comment
https://forums.phpfreaks.com/topic/189889-3-chars-with-permu/#findComment-1002191
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.