Home >Backend Development >PHP Tutorial >php判断unix时间戳大小疑点

php判断unix时间戳大小疑点

WBOY
WBOYOriginal
2016-06-13 09:59:33898browse

php判断unix时间戳大小问题
一段内容加了function要做的判断就是判断这段内容最后的数字是否大于系统当前的unix时间戳

例如

标题(标题内容不是固定的) 1324570103

这段内容就是提取里的unix时间戳和当前系统的unix时间戳比较,判断大小,比时间戳大的则返回,否则不显示

我知道是return "$str" 和return" "

但是中间的判断还请高手帮忙分析下


------解决方案--------------------

PHP code
function getContent($source){   if(empty($source)) return "";   $str = "这是我要返回的值了";   preg_match('/<span>(\d+)/isU',$source,$matches);   if($matches[1]>time()){      return $str;   }else{      return "";   }}//使用方法date_default_timezone_set("Asia/shanghai");$content ='<span>1324570103</span>';$res = getContent($content);<div class="clear">
                 
              
              
        
            </div></span>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn