- time: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
$currMonth = date('Y-m') ;
$ts = time() ;
$nextWed = false ;
do {
$currentWed = $nextWed ;
$nextWedTS = strtotime('next wednesday', $ts) ;
$ts = $nextWedTS ;
$nextWed = date('Y-m-d', $nextWedTS) ;
$nextWedMonth = date('Y-m', $nextWedTS) ;
} while ($nextWedMonth == $currMonth) ;
echo $currentWed;