PHP n no of factorial in dynamic sitemap logic
by Prabakaran[ Edit ] 2012-07-30 16:58:34
<?php
$arrayCount=4;
$no=array();
for($s=1;$s<=$arrayCount;$s++){
array_push($no,$s);
}
$tot=count($no);
$totFact=doFactorial ($tot);
function doFactorial ($x) {
if ($x <= 1)
return 1;
else
return ($x * doFactorial ($x-1));
}
$temp=array();
$i=0;
while($totFact>count($temp)){
shuffle($no);
for($a=0;$a<$tot;$a++){
$str.='#'.$no[$a];
}
if(!in_array($str, $temp)){
$str=str_replace("#","",$str);
array_push($temp,$str);
$i++;
}
$str='';
}
sort($temp);
print_r($temp);
?>