Created
October 14, 2010 10:37
-
-
Save kayue/625999 to your computer and use it in GitHub Desktop.
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
<? | |
/** | |
* Give name to preg_match | |
*/ | |
$haystack = '01 Jan 1970'; | |
$pattern = '/(?<day>\d{1,2})\ (?<month>Jan|Feb)\ (?<year>19\d\d)/'; | |
preg_match($pattern, $haystack, $matches); | |
print_r($matches); | |
// now there's $matches['day'], $matches['month'] ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment