我必须将时间与存储在变量中的时间值进行比较。我设计了逻辑,但它在时间上失败了。如何使用php比较两次
以下是逻辑:
$diff = "22:32:53";
if ($diff > strtotime("072:00:00"))
{
echo "DO A";
}
else if ($diff < strtotime("08:00:00"))
{
echo "DO B";
}
else if($diff > strtotime("08:00:00") && $diff < strtotime("072:00:00"))
{
echo "DO C";
}
但它呼应 “DO A” 而它应该显示 “DO C”。无法弄清楚我在哪里丢失的逻辑提前
感谢。
strtotime将有效的日期字符串转换为时间戳。 strtotime(“072:00:00”)返回false。 – cjs1978 2014-10-08 12:54:00