如下所示:
php" id="highlighter_876295">
1
2
3
4
5
6
7
8
9
10
11
12
13
|
function gettime( $worktime ){
$time =time();
$amount = date ( "Y" , $time )- date ( "Y" , strtotime ( $worktime ));
if ( date ( "m" , $time )< date ( "m" , strtotime ( $worktime ))) {
$amount --;
}
elseif ( date ( "m" , $time )== date ( "m" , strtotime ( $worktime ))) {
if ( date ( "d" , $time )< date ( "d" , strtotime ( $worktime ))) {
$amount --;
}
}
return $amount ;
}
|
以上这篇php 判断过去离现在几年的函数(实例代码)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。