title: Getting the date for current day in PHP
body: <p>I want to get the date for current day in php. what i tried is here...</p>
  
  <pre><code>echo $x."&lt;br&gt;";
  echo date("D",$x)."&lt;br&gt;";
  </code></pre>
  
  <p>But the output was </p>
  
  <pre><code>21-02-10
  Thu
  </code></pre>
  
  <p>It is giving correct date but not the correct day value.Why..?</p>
  
  <p>What I want day is the date for monday for the current week which can be generated on any day of the week. so what I did was, I'm taking the today's day and comparing with (Mon,Tue.... Sun) and respectively creating a timestamp using </p>
  
  <pre><code>case "Mon":
  
  $startdate1=date("d-m-y");
  $parts = explode('-',$startdate1);
  $startdate2 = date('d-m-Y',mktime(0,0,0,$parts[1],($parts[0]+1),$parts[2]));
  $startdate3 = date('d-m-Y',mktime(0,0,0,$parts[1],($parts[0]+2),$parts[2]));
  $startdate4 = date('d-m-Y',mktime(0,0,0,$parts[1],($parts[0]+3),$parts[2]));
  $startdate5 = date('d-m-Y',mktime(0,0,0,$parts[1],($parts[0]+4),$parts[2])); 
  $startdate6 = date('d-m-Y',mktime(0,0,0,$parts[1],($parts[0]+5),$parts[2]));
  $startdate7 = date('d-m-Y',mktime(0,0,0,$parts[1],($parts[0]+6),$parts[2]));
  
  $dates=array(1 =&gt; $startdate1,$startdate2,$startdate3,$startdate4,$startdate5,$startdate6,$startdate7);
  $i=1;
  while( $i &lt;= 7 )
  {
  echo $dates[$i];
  $i++;
  }
  break;
  </code></pre>
  
  <p>$date is the final array respective to today that has to be returned. Is there any other better method to do this operation.</p>