i have a following code. i have a array of month.
$m="";
$months = array(1=>'January',2=>'February',3=>'March',4=>'April',5=>'May',6=>'June',7=>'July',8=>'August',9=>'September',10=>'October',11=>'November',12=>'December');
foreach($objhst_fees->fetch_hst_fees("`month`,`fees`","where `grno`='".$stu_name['grno']."'")as $count_month)
{
//value like:$count_month['month']=1,2,3
$m .= $count_month['month'].",";
}
so assume $m=1,2,3,4,5,
then,i explode it and create array.
$paid_month = explode(",",$m);
$arr=array();
foreach($paid_month as $key=>$p)
{
array_push($arr,$p);
}
and then, i print the month name which is not in $arr
.
foreach($months as $key=>$a)
{
if(!in_array($key,$arr))
{
echo $a.",";
//echo $months[$key];
}
}
but i think,this method is to long for it.so what is the alternatives for doing this?