看看http://pear.php.net/package/Math_Combinatorics
<?phprequire_once 'Math/Combinatorics.php';$words = array('cat', 'dog', 'fish');$combinatorics = new Math_Combinatorics;foreach($combinatorics->permutations($words, 2) as $p) { echo join(' ', $p), "n"; }
cat dogdog catcat fishfish catdog fishfish dog
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)