title: How to check that day is last day of month in php?
body: <p>My previous question: <a href="https://stackoverflow.com/questions/21377798/how-to-find-current-day-no-in-month-in-php/21378561?noredirect=1#comment32241440_21378561">how-to-find-current-day-no-in-month-in-php</a></p>
  
  <p>Now I face another problem. Suppose I know that this <code>monday</code> is the <code>4th monday of the current month.</code> Now how to check that <code>this monday is also the last monday of the current month</code>?</p>
  
  <pre><code>exa:1 
  date: 27-01-2014
  </code></pre>
  
  <p>Using the code below, I get the name and number of a day:</p>
  
  <pre><code>day: monday   
  day no :4th
  </code></pre>
  
  <p>This is the 4th monday of january and it is also the last monday of january. How to check that?</p>
  
  <pre><code>exa:2  
  date: 20-01-2014   
  day: monday   
  day no :3rd
  </code></pre>
  
  <p>Here <code>this monday is 3rd monday of january but not last monday of january.</code></p>
  
  <p>So, in short, when I got a day number then how to check whether that the day number is last or not?</p>
  
  <p><code>code:</code></p>
  
  <pre><code>$t=date('d-m-Y');
  $dayName = strtolower(date("D",strtotime($t)));
  $dayNum = strtolower(date("d",strtotime($t)));
  $dayno = floor(($dayNum - 1) / 7) + 1
  </code></pre>