Generate all possible combinations using a set of strings

前端 未结 4 1189
小鲜肉
小鲜肉 2020-12-16 08:17

I\'m trying to generate all possible combinations of a set of strings, using each string maximum once.

  • The length of the output string isn\'t defined (the max
4条回答
  •  無奈伤痛
    2020-12-16 08:30

    What you require over the array is essentially a cartesian product. This is an aspect of set mathematics and is common in database systems as well as formal modelling languages. There will be a number of implementation solutions if you google this term for PHP.

    (I've never done any PHP directly which is why I don't want to post you an incorrect (or hacky) solution, but hopefully this will help lead you down the correct path)!

提交回复
热议问题