example:
<?php
$string = "This is some text written on 2010-07-18.";
preg_match('|(?<date>\d\d\d\d-\d\d-\d\d)|i',$string,$arr_result);
print_r($arr_result);
?>
returns:
Array
(
[0] => 2010-07-18
[date] => 2010-07-18
[1] => 2010-07-18
)
but I want it to be:
Array
(
[date] => 2010-07-18
)
in php's pdo object there is an option that is filtering results from database by removing these duplicate numbered values : PDO::FETCH_ASSOC (http://www.php.net/manual/en/pdostatement.fetch.php). But I haven't seen similar modifier for the pcre functions in php yet.