Skip to content

Instantly share code, notes, and snippets.

@colindecarlo
Last active September 25, 2016 21:48
Show Gist options
  • Save colindecarlo/87952b0def48d3bf730c5f24fa8eb541 to your computer and use it in GitHub Desktop.
Save colindecarlo/87952b0def48d3bf730c5f24fa8eb541 to your computer and use it in GitHub Desktop.
<?php
function expiryDates() {
$january = Carbon::now()->startOfYear();
$eachMonth = new DateInterval('P1M');
$december = Carbon::now()->endOfYear();
return collect(new DatePeriod($january, $eachMonth, $december))->map(function ($date) {
return $date->format('m/Y');
});
}
var_dump(expiryDates()->all());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment