我有一个php,如果它返回一个错误,这个错误:解析错误:语法错误,意外'=',包含此代码的行:$result -= 'tm_year' = 1900;
有人知道如何解决这个问题吗?
if (!function_exists( 'strptime' )) {
function strptime($strdate, $format) {
$plop = array( 's' => 'tm_sec', 'i' => 'tm_min', 'H' => 'tm_hour', 'd' => 'tm_mday', 'm' => 'tm_mon', 'Y' => 'tm_year' );
$regexp = preg_quote( $format, '/' );
$regexp = str_replace( array( '%d', '%m', '%Y', '%H', '%i', '%s' ), array( '(\d{2})', '(\d{2})', '(\d{4})', '(\d{2})', '(\d{2})', '(\d{2})' ), $regexp );
if (preg_match( '/^' . $regexp . '$/', $strdate, $m )) {
$result = array( 'tm_sec' => 0, 'tm_min' => 0, 'tm_hour' => 0, 'tm_mday' => 0, 'tm_mon' => 0, 'tm_year' => 0, 'tm_wday' => 0, 'tm_yday' => 0, 'unparsed' => '' );
preg_match_all( '/%(\w)/', $format, $patt );
foreach ($patt[1] as $k => $v) {
if (!isset( $plop[$v] )) {
continue;
}
$result[$plop[$v]] = intval( $m[$k + 1] );
if ($plop[$v] == 'tm_mon') {
$result -= $plop[$v] = 1;
continue;
}
}
$result -= 'tm_year' = 1900;
return $result;
}
return false;
}
}