1
0
Fork 0
php-coding/10.test3.php

23 lines
693 B
PHP

<?php
$start_run_time = run_time();
$time1 = date("Y-m-d H:i:s");
$time2 = "2008-2-3 16:30:00";
if (strtotime($time1) > strtotime($time2)) {
echo 'time1晚于time2';
} else if (strtotime($time1) < strtotime($time2)) {
echo 'time1早于time2';
} else {
echo 'time1等于time2';
}
$currentTime = time();
$targetTime = strtotime('2024-10-1');
echo '距离2024年国庆还有' . ceil(($targetTime - $currentTime) / 60 / 60 / 24) . '天<br>';
echo microtime() . "<br>";
$end_run_time = run_time();
echo 'php运行时间:'.$end_run_time-$start_run_time;
function run_time(): float
{
list($micro_sec, $sec) = explode(' ', microtime());
return (float)$micro_sec + (float)$sec;
}
?>