Home  >  Article  >  Backend Development  >  一道关于microtime()的题目,该怎么处理

一道关于microtime()的题目,该怎么处理

WBOY
WBOYOriginal
2016-06-13 10:08:02968browse

一道关于microtime()的题目
php获取时间的函数
$gtc_end_time = microtime(true);

 
从下面这种数列中(1000个吧),
19493845809,24359390850934,3435345,4345345,5345345,6345345,73453453 …… 
判断某个数:234343345 是否存在这里面,
计算一下看需要多少时间

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

PHP code
$k = 10000;$ar = range(1, $k);$t =  microtime(true);if(in_array($k, $ar))  echo microtime(true) - $t;<div class="clear">
                 
              
              
        
            </div>
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