Código PHP:
Ver original<?php
function dayInYear($year) {
$names = ['domingo', 'lunes', 'martes', 'miercoles', 'jueves', 'viernes', 'sabado'];
$fistDayInYear = new DateTime("{$year}-01-01");
$days[$fistDayInYear->format('w')] += 1;
$days[($fistDayInYear->format('w') + 1) % 7] += $fistDayInYear->format('L');
}
$days = dayInYear(2017);