What are some best practices for converting dates to day of the year and storing them in arrays for comparison in PHP?

When converting dates to day of the year and storing them in arrays for comparison in PHP, it's important to use the `strtotime` and `date` functions to convert the dates to day of the year format. Storing these values in arrays allows for easy comparison and manipulation of dates in your PHP code.

// Convert dates to day of the year and store them in arrays for comparison

$dates = ['2022-01-01', '2022-02-15', '2022-03-30', '2022-04-10'];
$day_of_year = [];

foreach ($dates as $date) {
    $day_of_year[] = date('z', strtotime($date));
}

print_r($day_of_year);