2桁表記の西暦を4桁に直したい時(例:10/04/30)とか。
<?php
function year_opt224($string) {
yearpat1 = '#^9\d{1}/#';
yearpat2 = '#^[0-8]\d{1}/#';
224_opt1 = '19$0';
224_opt2 = '20$0';
$pattern = array(yearpat1, yearpat2);
$replace = array(224_opt1, 224_opt2);
$string = preg_replace($pattern, $replace, $string);
return $string;
}
?>