etiennetremel / PHP-Find-Date-in-String

Function to find a date in a string using Regular Expression
45 stars 14 forks source link

Find Date in String

Function to find a date in a string using Regular Expression

Usage

$string = "This building was cleaned on the 8th of October 2006 after a huge storm."
$date = find_date( $string );

// Return:
array(
    'day'   => 08,
    'month' => 10,
    'year'  => 2006
);

Other examples: