PX : code

Get current week to display by ravi
Download this code


<?php
class GetWeek
{
Function 
setDay()
  {
       
$todaystrtotime(now);
       
$day=date(D);    
       switch(
$day)
         {
            case 
"Mon":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now)+(86400);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now)+2*(86400);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now)+3*(86400);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now)+4*(86400);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now)+5*(86400);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now)+6*(86400);
                        
$ary[]=$Sun;
                    break;            
            case 
"Tue":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now)-(86400);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now)+(86400);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now)+2*(86400);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now)+3*(86400);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now)+4*(86400);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now)+5*(86400);
                        
$ary[]=$Sun;
                    break;
                        case 
"Wed":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now)-2*(86400);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now)-(86400);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now)+(86400);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now)+2*(86400);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now)+3*(86400);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now)+4*(86400);
                        
$ary[]=$Sun;
                    break;            
                        case 
"Thu":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now)-3*(86400);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now)-2*(86400);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now)-(86400);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now)+(86400);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now)+2*(86400);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now)+3*(86400);
                        
$ary[]=$Sun;
                    break;                        
            case 
"Fri":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now)-4*(86400);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now)-3*(86400);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now)-2*(86400);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now)-(86400);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now)+(86400);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now)+2*(86400);
                        
$ary[]=$Sun;
                    break;                    
            case 
"Sat":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now)-5*(86400);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now)-4*(86400);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now)-3*(86400);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now)-2*(86400);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now)-(86400);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now)+(86400);
                        
$ary[]=$Sun;
                    break;                    
            case 
"Sun":
            
$startTimeStamp=strtotime(now);
                        
$Mon=strtotime(now)-6*(86400);
                        
$ary[]=$Mon;
                        
$Tus=strtotime(now)-5*(86400);
                        
$ary[]=$Tus;
                        
$Wed=strtotime(now)-4*(86400);
                        
$ary[]=$Wed;
                        
$Thu=strtotime(now)-3*(86400);
                        
$ary[]=$Thu;
                        
$Fri=strtotime(now)-2*(86400);
                        
$ary[]=$Fri;
                        
$Sat=strtotime(now)-(86400);
                        
$ary[]=$Sat;
                        
$Sun=strtotime(now);
                        
$ary[]=$Sun;
                    break;                    
         }
         return (
$ary);
  }
}


//Test function
$week=new GetWeek();
$dayarray=$week->setDay();

echo 
"<p></p>";
echo 
date('l, d M Y',$dayarray[0])."<p></p>";
echo 
date('l, d M Y',$dayarray[1])."<p></p>";
echo 
date('l, d M Y',$dayarray[2])."<p></p>";
echo 
date('l, d M Y',$dayarray[3])."<p></p>";
echo 
date('l, d M Y',$dayarray[4])."<p></p>";
echo 
date('l, d M Y',$dayarray[5])."<p></p>";
echo 
date('l, d M Y',$dayarray[6])."<p></p>";
?>

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.