- var_dump: documentation ( source)
- preg_match: documentation ( source)
- trim: documentation ( source)
<?php
foreach (array('19.03.2014','30.02.1980','1.1.1970','1781980', '04071792') as $value) {
print("$value\n");
if (1 === preg_match('/^([0-3]?[0-9])\\.?([01]?[0-9])\\.?((19|20)[0-9][0-9])$/', trim($value), $matches)) {
var_dump($matches);
} else {
print("No match\n");
}
}