开发者

Get all combinations of array

开发者 https://www.devze.com 2023-02-10 02:33 出处:网络
Merged with Cartesian Product of开发者_Go百科 N arrays. I need to get all combinations of array. Example:
Merged with Cartesian Product of开发者_Go百科 N arrays.

I need to get all combinations of array.

Example:


array
                (
                    array("a","b"),               
                    array("1","2","3","4")                
                );

And i need to get

array
                (
                    array("a","1"),               
                    array("a","2"),               
                    array("a","3"),               
                    array("a","4"),               
                    array("b","1"),               
                    array("b","2"),               
                    array("b","3"),               
                    array("b","4"),               
                );

Of course it must work when sizeof($array) >= 2.

Thanks much

0

精彩评论

暂无评论...
验证码 换一张
取 消