title: Get previous week number from php week number
body: <p>I currently need to get the previous week from a variable that passes a php week number so if it is week 13 I will get week 12.</p>
  
  <p>The problem I am facing is that if I just minus 1 from the original number if I am in week 1 it will return week 0 unless I create an if statement ie:</p>
  
  <pre><code>if($week==1)
  {
      $prev_week=52;
      $prev_year=$year-1;
  }
  </code></pre>
  
  <p>This is assuming that php counts the weeks from 1 and not 0. This seems a bit clumsy and I was thinking there may be a better way of doing this utilizing PHP's many date and time functions.</p>