Please help me with this
<html>
: <head>
: <script>
: n = 20
: r = 5
:
: var combination = new Array(r);
:
: for(i=0; i<r; i++)
: combination[i] = 0;
:
: function getNextCombination(n, r) {
: if(combination[0]==0) { // First time here, make the initial combination
: for(i=0; i<r; i++)
: combination[i] = i+1;
: }
: else {
: // n+index-r is max value (index : 1 -> r)
: index = r;
: while(combination[index-1]==n+index-r && index>0)
: index--;
: if(index==0)
: return false;
: combination[index-1]++;
: for(index++; index<=r; index++)
: combination[index-1] = combination[index-2]+1;
: }
: return true;
: }
: function showNext() {
: val = getNextCombination(n, r);
: if(!val) // No more combinations found
: return val;
:
: txt = "";
: for(i in combination)
: txt+=combination[i]+", ";
:
: // Show the combination somewhere
: window.status = txt;
:
:
: return val;
: }
: function init() {
: for(p=0; p<50000 && showNext(); p++); // Shows the first 50000 combinations or as many as there are
: }
: </script>
: </head>
: <body onload="init()">
: </body>
: </html>
i want the same result in in php and my condition is i want to pass different king of numbers in . now this combinations goes sequence number like 1,2,3,4,5,6 and i want a combinations of different numbers from a array like i need a result of array(1,12,32,24,14) and r value is default 7 . can any one provide me a solution for this in php.
Thank in advance who ever helps me .