得到n个工作日

I need 4 occurrence of Friday with date. Start date from 2014-05-25

Following will be the answer in this case.

2014-05-30
2014-06-06
2014-06-13
2014-06-20

There can be n occurrence of specific weekday and i need solution purely in PHP not in mysql

Take a look into this.

You can do something like:

strtotime("+1 week", timestamp);

Where timestamp is the UNIX timestamp for the start date. You can replace 1 with a variable, and by using a loop you can write a generic function.

Hope this helps.

Edit #1:

Also, you can recur to strtotime() to generate your timestamp:

strtotime("+1 week", strtotime('2014-05-30'));

A possible whole solution would be (untested code):

for ($i = 1; $i <= 4; $i ++) {
   strtotime("+" . $i . " week", strtotime('2014-04-25'));
}