Getting the date for current day in PHP

I tried this to get current day.

echo date('l'); // output: current day.

What i did to resolve it is used the date format ('d-m-Y') instead of ('d-m-y') in date function, which was causing the problem. Hence strtotime accepted the format and gave the correct result for

$t=date('d-m-Y');
echo date("D",strtotime($t));

What I want day is the date for monday for the current week which can be generated on any day of the week.

That's what you want. $mday is the month day of this week's Monday. Nevermind if it's not positive, mktime will handle that right. $monday has the timestamp of the Monday's midnight.

$now = getdate();
$mday = $now['mday'] - ($now['wday'] + 6) % 7;
$monday = mktime(0, 0, 0, $now['mon'], $mday, $now['year']);
echo(date('d-m-y', $monday));

How about this:

//today is monday
if (1 == date('N')){
    $monday = time();
}else{
    $monday = strtotime('last Monday');
}

for ($i = 0; $i < 7; $i++){
    echo date('d-m-Y', $monday) . '<br>';
    $monday = strtotime('tomorrow', $monday);
}

First find Monday, if it is not today, then print 7 dates