selecting a day of the week every x number of days thats not a weekend
<p>I have code already for a date range that works fairly well (not using datetime class, I'm stuck in 5.2). But I want to modify it to select the previous day before the weekend (e.g. friday) based on every fortnight from the starting date.</p>

<p>I have been experimenting with finding all the saturdays and sundays then doing a <code>array_search</code> with a <code>mktime</code> as such: <code>mktime(0, 0, 0, date("m", $date), date("d", $date)-1, date("Y", $date)</code></p>

<p>It seems to find all the Saturdays &amp; Sundays but my code seems replace the actual dates instead of just selecting the previous day and styling it.</p>

<p>My code is a bit of a mess, but its pretty generic date range, e.g. while <code>($date1 &lt;= $date2) { do stuff here }</code></p>

<p>So how can I select the friday before a weekend of a number of every 14 days from the start date.</p>

<p>Edit:
The answers below were all fine, but not quite what I was asking. Hopefully I can be more clear here.
I don't want code that finds me all the fridays in a date range specifically, I want to do a date range and every time there is a friday that is +14 days from the start date (i.e. every 2 weeks) I want to style it so it stands out. I have managed to find all the weekends every 2 weeks and style it, but I can't figure out how to select the friday's 2 weeks in advance from the start date.</p>
