我想将时间条目分成3个独立的变量,即:
07:15:20
到
$hour = 07
$minute = 15
$second = 20
我知道这对大多数人来说都是一个非常基本的问题,但我现在有点挣扎:)
答案 0 :(得分:0)
我能想到的最简单方法
<?php
$time = "07:15:20";
$time = explode(":",$time);
$hour = $time[0];
$minute = $time[1];
$second = $time[2];
?>
答案 1 :(得分:0)
<?php
$time = "07:15:20";
list($hour,$minute,$second) = explode(":", $time);
print $hour . " - " . $minute . " - " . $second;
?>