title: How to use a for loop inside a return in php using functions?
body: <p>i have the following function to populate a birthday selection field</p>
  
  <pre><code>function birthday_selector()
  {
  return '
           &lt;select class="birth_month_select" name="birth_m"&gt;
             &lt;option value=""&gt;Month&lt;/option&gt;
             &lt;option value="01"&gt;Jan&lt;/option&gt;
             &lt;option value="02"&gt;Feb&lt;/option&gt;
             &lt;option value="03"&gt;Mar&lt;/option&gt;
             &lt;option value="04"&gt;Apr&lt;/option&gt;
             &lt;option value="05"&gt;May&lt;/option&gt;
             &lt;option value="06"&gt;Jun&lt;/option&gt;
             &lt;option value="07"&gt;Jul&lt;/option&gt;
             &lt;option value="08"&gt;Aug&lt;/option&gt;
             &lt;option value="09"&gt;Sep&lt;/option&gt;
             &lt;option value="10"&gt;Oct&lt;/option&gt;
             &lt;option value="11"&gt;Nov&lt;/option&gt;
             &lt;option value="12"&gt;Dec&lt;/option&gt;
           &lt;/select&gt;
           &lt;!----Select day-----&gt;
           &lt;select class="birth_day_select" name="birth_d"&gt;
             &lt;option value=""&gt;Day&lt;/option&gt;
  
           &lt;/select&gt;
           &lt;!----Select Year------&gt;
           &lt;select  class="birth_year_select" name="birth_y"&gt;
             &lt;option value=""&gt;Year&lt;/option&gt;
  
           &lt;/select&gt;';
  }
  </code></pre>
  
  <p>now i need to use the following for loop inside this function</p>
  
  <p>THE LOOP</p>
  
  <pre><code>             for($i=1;$i&lt;=31;$i++)
               {
                  if($i &lt;=9){ $new_i='0'.$i; }
                  else{ $new_i=$i; }
  
                  echo '&lt;option value="'.$new_i.'"&gt;'.$new_i.'&lt;/option&gt;';
               }
  </code></pre>
  
  <p>How to i use that for loop in  the function <B>Note: </b>that im not and expert in arrays so a little help would be appreciated....</p>
  
  <p><B>Also Note: </b>i cant use any echo statements it will screw up my file</p>