Last active
November 4, 2015 12:26
-
-
Save sectsect/1b63266f885d6c64ef3c to your computer and use it in GitHub Desktop.
Removing expired dates from an array 💀PHP5.3+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = array( | |
'1/10/2014', | |
'1/11/2014', | |
'1/12/2014', | |
'1/13/2014', | |
'1/14/2014' | |
); | |
$array = array_filter($array,function($date){ | |
return strtotime($date) >= strtotime('today'); | |
}); | |
print_r($array); //Array ( [2] => 1/12/2014 [3] => 1/13/2014 [4] => 1/14/2014 ) | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment