felito Posted June 22, 2011 Share Posted June 22, 2011 hi how can i get only the years, and check them? what i am trying: $year = strtok($date, '-'); //problem here - only get the first year of array $date = array ("1979-06-13", "2979-06-13"); foreach ($date as $key) { if (2000 > $year) { echo ('true'); } else echo ("error"); } but i get true, true, so the second date is not working... thanks Link to comment https://forums.phpfreaks.com/topic/240050-problem-with-date/ Share on other sites More sharing options...
felito Posted June 22, 2011 Author Share Posted June 22, 2011 foreach ($date as $key) { $year = strtok($key, '-'); if (3000 > $year) { echo ('true'); } else echo ("error"); } solved, thanks Link to comment https://forums.phpfreaks.com/topic/240050-problem-with-date/#findComment-1233089 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.