<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'7 number combiantions from an array' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread '7 number combiantions from an array' posted on the 'PHP' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 17:46:54 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 17:46:54 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>7 number combiantions from an array</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/416634/416634/7-number-combiantions-from-an-array/</link>
      <description>Please help me with this&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
: &amp;lt;head&amp;gt;&lt;br /&gt;
: &amp;lt;script&amp;gt;&lt;br /&gt;
: n = 20&lt;br /&gt;
: r = 5&lt;br /&gt;
: &lt;br /&gt;
: var combination = new Array(r);&lt;br /&gt;
: &lt;br /&gt;
: for(i=0; i&amp;lt;r; i++)&lt;br /&gt;
: 	combination[i] = 0;&lt;br /&gt;
: &lt;br /&gt;
: function getNextCombination(n, r) {&lt;br /&gt;
: 	if(combination[0]==0) { // First time here, make the initial combination&lt;br /&gt;
: 		for(i=0; i&amp;lt;r; i++)&lt;br /&gt;
: 			combination[i] = i+1;&lt;br /&gt;
: 	}&lt;br /&gt;
: 	else {&lt;br /&gt;
: 		// n+index-r is max value (index : 1 -&amp;gt; r)&lt;br /&gt;
: 		index = r;&lt;br /&gt;
: 		while(combination[index-1]==n+index-r &amp;amp;&amp;amp; index&amp;gt;0)&lt;br /&gt;
: 			index--;&lt;br /&gt;
: 		if(index==0)&lt;br /&gt;
: 			return false;&lt;br /&gt;
: 		combination[index-1]++;&lt;br /&gt;
: 		for(index++; index&amp;lt;=r; index++)&lt;br /&gt;
: 			combination[index-1] = combination[index-2]+1;&lt;br /&gt;
: 	}&lt;br /&gt;
: 	return true;&lt;br /&gt;
: }&lt;br /&gt;
: function showNext() {&lt;br /&gt;
: 	val = getNextCombination(n, r);&lt;br /&gt;
: 	if(!val) // No more combinations found&lt;br /&gt;
: 		return val;&lt;br /&gt;
: &lt;br /&gt;
: 	txt = "";&lt;br /&gt;
: 	for(i in combination)&lt;br /&gt;
: 		txt+=combination[i]+", ";&lt;br /&gt;
: &lt;br /&gt;
: 	// Show the combination somewhere&lt;br /&gt;
: 	window.status = txt;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: 	return val;&lt;br /&gt;
: }&lt;br /&gt;
: function init() {&lt;br /&gt;
: 	for(p=0; p&amp;lt;50000 &amp;amp;&amp;amp; showNext(); p++); // Shows the first 50000 combinations or as many as there are&lt;br /&gt;
: }&lt;br /&gt;
: &amp;lt;/script&amp;gt;&lt;br /&gt;
: &amp;lt;/head&amp;gt;&lt;br /&gt;
: &amp;lt;body onload="init()"&amp;gt;&lt;br /&gt;
: &amp;lt;/body&amp;gt;&lt;br /&gt;
: &amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
Thank in advance who ever helps me .&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/416634/416634/7-number-combiantions-from-an-array/</guid>
      <pubDate>Fri, 21 May 2010 06:17:18 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: 7 number combiantions from an array</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/416634/417048/re-7-number-combiantions-from-an-array/#417048</link>
      <description>Well, replace "&amp;lt;script&amp;gt;" for "&amp;lt;?php", "&amp;lt;/script&amp;gt;" for "?&amp;gt;", delete the "var" word and add a "$" sign on each variable and you will get your php code ;)</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/416634/417048/re-7-number-combiantions-from-an-array/#417048</guid>
      <pubDate>Sun, 06 Jun 2010 18:26:26 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: 7 number combiantions from an array</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/416634/417079/re-7-number-combiantions-from-an-array/#417079</link>
      <description>i did this before and some of the functions are not running like for(i in var). &lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/416634/417079/re-7-number-combiantions-from-an-array/#417079</guid>
      <pubDate>Mon, 07 Jun 2010 21:40:05 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: 7 number combiantions from an array</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/416634/417100/re-7-number-combiantions-from-an-array/#417100</link>
      <description>I missed a few more changes you have to do:&lt;br /&gt;
&lt;br /&gt;
$combination = array();&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
function getNextCombination&lt;br /&gt;
global $combination; &amp;lt;------------ add this as function first line&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function showNext&lt;br /&gt;
global $combination, $n, $r; &amp;lt;-------- add this line&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Replace this:&lt;br /&gt;
for(i in combination)&lt;br /&gt;
txt+=combination[i]+", ";&lt;br /&gt;
window.status = txt;&lt;br /&gt;
&lt;br /&gt;
With this:&lt;br /&gt;
foreach ($combination as $c)&lt;br /&gt;
$txt.=$c.", ";&lt;br /&gt;
echo $txt."&amp;lt;br&amp;gt;";&lt;br /&gt;
&lt;br /&gt;
Delete all html code, and the last line shoud be:&lt;br /&gt;
init();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I thinks now you can get it!</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/416634/417100/re-7-number-combiantions-from-an-array/#417100</guid>
      <pubDate>Tue, 08 Jun 2010 16:59:59 -0700</pubDate>
      <category>PHP</category>
    </item>
    <item>
      <title>Re: 7 number combiantions from an array</title>
      <link>http://www.programmersheaven.com/mb/phpstuff/416634/417128/re-7-number-combiantions-from-an-array/#417128</link>
      <description>Thank you very much CJNimes. I got the result Hurrey..&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/phpstuff/416634/417128/re-7-number-combiantions-from-an-array/#417128</guid>
      <pubDate>Wed, 09 Jun 2010 21:51:46 -0700</pubDate>
      <category>PHP</category>
    </item>
  </channel>
</rss>