title: How can I get the days of the month by using php?
body: <p><img src="https://i.stack.imgur.com/W6jMd.png" alt="enter image description here">I want to display the dates of respective days in particular month. How can I do it? I only manage to input the month and show all the dates.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;body&gt;
  &lt;form method="POST"&gt;
  Day (Eg: Sunday) : &lt;input name="day" required type="text" size="30" style="height:30px;" /&gt; &lt;br/&gt;&lt;br/&gt;
  Month (Eg: 7) : &lt;input name="month" required type="text" size="30" style="height:30px;" /&gt; &lt;br/&gt;&lt;br/&gt;
  &lt;input name="Submit" type="submit" value="Log In" style="background-color: #2E9AFE; border: 1px solid #084B8A;  padding: 1px 3px; color:#fff; width:60px; height:30px;" /&gt;
  &lt;/form&gt;
  
  &lt;?php
  
   $day=$_POST['day'];
   $month=$_POST['month'];
   
      function getDates($y, $m)
   {
    return new DatePeriod(
     new DateTime("first sunday of $y-$m"),
     DateInterval::createFromDateString('next sunday'),
     new DateTime("last day of $y-$m")
    );
   }
  
   foreach (getDates(2015, $month) as $getDay) {
    echo $getDay-&gt;format("l, Y-m-d\n");
   }
  
   
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>