tqla Posted February 27, 2010 Share Posted February 27, 2010 This variable reflects the current year. 2010. $thisYear = date("Y", $time); How can I modify it to reflect the current year plus all subsequent years? For example: $thisYear = 2010, 2011, 2012, and so on forever. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/193580-date-question/ Share on other sites More sharing options...
Stephen Posted February 27, 2010 Share Posted February 27, 2010 Something like: <?php $thisYear = date("Y", time()); $i = 0; do { echo intval($thisYear)+$i; $i++; } while(true); ?> Quote Link to comment https://forums.phpfreaks.com/topic/193580-date-question/#findComment-1019037 Share on other sites More sharing options...
tqla Posted February 27, 2010 Author Share Posted February 27, 2010 Thanks Stephen. You led me in the right direction. I'm gonna use the while loop and I am gonna cap it at 10 years. $thisYear = date("Y", time()); while($thisYear <= '2020'){ $newYear = $thisYear; echo intval($newYear); echo '<br />'; $thisYear++; } Quote Link to comment https://forums.phpfreaks.com/topic/193580-date-question/#findComment-1019046 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.