Skip weekends in php date

Posted: asked May 19 at 11:21 - Source : stackoverflow

I have this code :

 for ($i = 2; $i > -3; $i--)
    { 
        $class="";

        if(date('D d-m')==date('D d-m', strtotime($i . ' days ago')))
        { 
          $class=' class="distinct"'; 
        }

        echo '<li'.$class.'>'.date('D d-m', strtotime($i . ' days ago')) . '</li>'.'<br />';

    }

And it outputs this:

Wed 17-05

Thu 18-05

Fri 19-05

Sat 20-05

Sun 21-05

I was wondering how i can skip the weekends, so it only shows the 5 days monday-friday. Any ideas how to exclude this?