Jim wrote:
> Hi!
> Could someboy please help me with this simple task (at least I though it
> would be simple):
> I need to split a string with two dates in into two datestrings, and there
> might be whatever between the dates, e.g.
> $datestring = "010101aaaaa020202", or $dateting = " 010101+++++++++020202
> "
> Then I thought that
> $date = preg_split("/[D]+/",trim($datestring))
> whould do the job, but it didn't.
> Why? and how should it be?
> Many thanks in advance!
> br Jim
How about going for a different approch.
// Trim it as you did
$dateString = trim($dateString);
// Select the first 6 chars as $date1...
$date1 = substr($dateString, 0, 6);
// ... and the last 6 as $date2
$date2 = substr($dateString, -6);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php