Skip to content

Instantly share code, notes, and snippets.

@EricTendian
Created May 27, 2013 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricTendian/5659020 to your computer and use it in GitHub Desktop.
Save EricTendian/5659020 to your computer and use it in GitHub Desktop.
Calculate what year in a 4-year program (high school or college) you are in based off of your graduation year. $gradYear is your graduation year, and $year corresponds to your current year (1-Freshman, 2-Sophomore, 3-Junior, 4-Senior).
<?php
$currentMonth = date("m", time());
$currentYear = date("Y", time());
if (7 > $currentMonth < 12) $year = 4 - ($gradYear - ($currentYear+1));
else $year = 4 - ($gradYear - ($currentYear));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment