Forum Moderators: coopster
echo $combination."<br>"; to anything else, I get this error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 35 bytes) in /home/blahblahblah.php on line blah. I get the error if I delete the line, or if I replace it with anything else. I want to replace that line with rules that say which resulting combinations should have more stuff done with them. After that, that resulting combination can disappear.
$params=array($h[0],$h[1],$h[2],$h[3],$h[4],$h[5],$h[6],$h[7],$w[0],$w[1],$w[2],$w[3],$w[4],$w[5],$w[6],$w[7],$t[0],$t[1],$t[2],$t[3],$t[4],$t[5],$t[6],$t[7]);
$combinations=getCombinations($params);
function getCombinations($array)
{
$length=sizeof($array);
$combocount=pow(2,$length);
for ($i = 1;$i<$combocount;$i++)
{
$binary = str_pad(decbin($i), $length, "0", STR_PAD_LEFT);
$combination='';
for($j=0;$j<$length;$j++)
{
if($binary[$j]=="1")
$combination.=$array[$j];
}
$combinationsarray[]=$combination;
echo $combination."<br>";
}
return $combinationsarray;
}
[edited by: brotherhood_of_LAN at 8:46 pm (utc) on Sep 22, 2012]