1 Star 0 Fork 0

hzy101 / PhpTest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
d.php 1.58 KB
一键复制 编辑 原始数据 按行查看 历史
hzy101 提交于 2019-07-21 22:22 . php入门--慕课网
<?php
/**
* Created by PhpStorm.
* User: 59810
* Date: 2019/7/20
* Time: 17:53
*/
//设置默认时区,防止异常
date_default_timezone_set('UTC');
header('content-type:text/html;charset=utf-8');
echo '时间戳为:'.time();
echo '<hr/>';
echo date('Y-m-d H:i:s'),'<br/>';
echo '一天之后的这个时间',date('Y-m-d H:i:s', time()+24*60*60);
echo '<hr/>';
echo mktime(0, 0, 0, 6, 1, 1994);
echo '</br>';
echo date('Y-m-d H:i:s', mktime(0, 0, 0, 6, 1, 1990));
echo '</hr>';
echo '</br>';
$birth = mktime(0, 0, 0, 6,1 , 1990);
$time = time();
$age = floor(($time - $birth)/(24*3600*365));
echo '活了多少岁:',$age;
echo '</br>';
echo '计算今年与94年的年距:';
$distant = date('Y')-1994;
echo $distant;
echo '</br>';
echo strtotime("last Monday"), "\n";
echo '</br>';
echo time();
echo strtotime('now'),'<br/>';
echo '</br>';
echo date('Y-m-d H:i:s', time()+24*3600),'</br>';
echo date('Y-m-d H:i:s', strtotime('+1 day')),'</br>';
echo date('Y-m-d H:i:s', strtotime('-1 day'));
echo date('Y-m-d H:i:s', strtotime('+5 days')),'</br>';
echo date('Y-m-d H:i:s', strtotime('+1 month')),'</br>';
echo '</br>';
echo 'microtime返回微秒';
echo '</br>';
echo microtime(),'</br>';
echo time(),'</br>';
echo microtime(true),'</br>';
$start = microtime(true);
for($i=0; $i<10000; $i++) {
$array[] = $i;
}
$end = microtime(true);
echo $end - $start,'</br>';
echo round($end - $start ,4),'</br>','</br>';
print_r(getdate());
echo '</br>';
print_r(gettimeofday());
echo '</br>';
var_dump(checkdate(8, 12, 2016));
echo '</br>';
var_dump(checkdate(18, 12, 2016));
echo '</br>';
echo '</br>';
1
https://gitee.com/mayun_hzy/PhpTest.git
git@gitee.com:mayun_hzy/PhpTest.git
mayun_hzy
PhpTest
PhpTest
master

搜索帮助