function second_statistics($strs){ $minute=0; if($strs){ $patterns = "/(\d+)时/"; preg_match_all($patterns,$strs,$zzTime); $Time=isset($zzTime[1][0])?$zzTime[1][0]:0; $patterns = "/(\d+)分/"; preg_match_all($patterns,$strs,$zzTimeFen); $TimeFen=isset($zzTimeFen[1][0])?$zzTimeFen[1][0]:0; $patterns = "/(\d+)秒/"; preg_match_all($patterns,$strs,$zzTimeMiao); $TimeMiao=isset($zzTimeMiao[1][0])?$zzTimeMiao[1][0]:0; $minute=$Time*60*60+$TimeFen*60+$TimeMiao; } return $minute; } $v_time_zhibo="00时21分20秒"; $v_time_zhibo_sec=second_statistics($v_time_zhibo);
以上就是PHP时分秒转换为秒数的详细内容,更多关于PHP时分秒转换为秒数的资料请关注九品源码其它相关文章!