code: protected static function dayOfYear($y, $m, $d) {
      $l = ((int)$y % 4 == 0 && (int)$y % 100 != 0) || (int)$y % 400 == 0;
      $k = $l ? 1 : 2;
      $n = intval(275 * (int)$m / 9) -
              $k * intval(((int)$m + 9) / 12) +
              (int)$d - 30;
  
      return (int)$n;
    }
docs: Finds the day of the year number for a given date
  
  @param  int $y Year
  @param  int $m Month
  @param  int $d Day
  @return int    Day of the year number