PHP combinations of array elements -


i want generate possible combination of array elements fill placeholder, placeholder size vary.

let have array $a = array(3, 2, 9, 7) , placeholder size 6. want generate following:

3,3,3,3,3,3 2,3,3,3,3,3 2,2,3,3,3,3 ........... ........... 7,7,7,7,7,9 7,7,7,7,7,7 

however (2,3,3,3,3,3) considered same (3,2,3,3,3,3) later 1 doesn't count.

could point me right direction? know there math_combinatorics pear package, 1 applicable placeholder size <= count($a).

edit thinking 1 similar bits string combination though different number base

i have no php source code sources might help.

some c code. @ 2.1: http://www.aconnect.de/friends/editions/computer/combinatoricode_g.html

delphi code: combination without repetition of n elements without use for..to..do

wiki article here


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -