Dave Goodchild wrote:
Any ideas on the most efficient way to do it? I am working on using
combinations of array_search, in_array and so on and want to avoid
regular
expressions if I can. Many thanks in advance for any suggestions!
If you mean that you only want one date for each month (you'll end up
with the last one), then it's very simple:
foreach ($dates as $date) {
preg_match('/[a-z]{3} \d{4}/i', $date, $m);
$newDates[$m[0]] = $date;
}
If you're really averse to regex, you could use date('Y-m',
strtotime($date)) there instead, but I suspect that would perform far worse.
Arpad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php