permutation using regular expression in php
问题 Is there any way to get permutation of all words in a string using only regular expression in php. For example: for input like "How to remove pain in human knee" I want output as: "How To", "How","pain knee","remove knee","knee pain","in remove","human pain knee", etc. 回答1: Using regex will only serve to slow down the process. I have written a function based on the powerSet() function posted by Yada @ https://stackoverflow.com/a/27968556/2943403) Code: (Demo) function permStacker($array){