3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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"); } }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
19.03.2014 array(5) { [0]=> string(10) "19.03.2014" [1]=> string(2) "19" [2]=> string(2) "03" [3]=> string(4) "2014" [4]=> string(2) "20" } 30.02.1980 array(5) { [0]=> string(10) "30.02.1980" [1]=> string(2) "30" [2]=> string(2) "02" [3]=> string(4) "1980" [4]=> string(2) "19" } 1.1.1970 array(5) { [0]=> string(8) "1.1.1970" [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(4) "1970" [4]=> string(2) "19" } 1781980 array(5) { [0]=> string(7) "1781980" [1]=> string(2) "17" [2]=> string(1) "8" [3]=> string(4) "1980" [4]=> string(2) "19" } 04071792 No match