本文整理汇总了PHP中cmp3函数的典型用法代码示例。如果您正苦于以下问题:PHP cmp3函数的具体用法?PHP cmp3怎么用?PHP cmp3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmp3函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userdate
# Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . userdate($row[1], hour_min_format());
break;
case "< = ":
# Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
# Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = ereg_replace(" ", " ", period_time_string($row[0]));
$end_str = ereg_replace(" ", " ", period_time_string($row[1], -1));
switch (cmp3($row[0], $midnight[$day_num]) . cmp3($row[1], $midnight_tonight[$day_num] + 1)) {
case "> < ":
# Starts after midnight, ends before midnight
# Starts after midnight, ends before midnight
case "= < ":
# Starts at midnight, ends before midnight
$d[$day_num]["data"][] = $start_str . "~" . $end_str;
break;
case "> = ":
# Starts after midnight, ends at midnight
$d[$day_num]["data"][] = $start_str . "~24:00";
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = $start_str . "~====>";
break;
示例2: date
$day_num = date("j", $t);
$midnight = mktime(0, 0, 0, $month, $day_num, $year);
while ($t < $end_t) {
if ($debug_flag) {
echo "<br>DEBUG: Entry {$row['2']} day {$day_num}\n";
}
$d[$day_num]["id"][] = $row[2];
$d[$day_num]["shortdescrip"][] = $row[3];
$midnight_tonight = $midnight + 86400;
# Describe the start and end time, accounting for "all day"
# and for entries starting before/ending after today.
# There are 9 cases, for start time < = or > midnight this morning,
# and end time < = or > midnight tonight.
# Use ~ (not -) to separate the start and stop times, because MSIE
# will incorrectly line break after a -.
switch (cmp3($row[0], $midnight) . cmp3($row[1], $midnight_tonight)) {
case "> < ":
# Starts after midnight, ends before midnight
# Starts after midnight, ends before midnight
case "= < ":
# Starts at midnight, ends before midnight
$d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~" . date(hour_min_format(), $row[1]);
break;
case "> = ":
# Starts after midnight, ends at midnight
$d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~24:00";
break;
case "> > ":
# Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = date(hour_min_format(), $row[0]) . "~====>";
break;
示例3: htmlspecialchars
// Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time']));
break;
case "< = ":
// Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = period_time_string($row['start_time']);
$end_str = period_time_string($row['end_time'], -1);
switch (cmp3($row['start_time'], $midnight[$day_num]) . cmp3($row['end_time'], $midnight_tonight[$day_num] + 1)) {
case "> < ":
// Starts after midnight, ends before midnight
// Starts after midnight, ends before midnight
case "= < ":
// Starts at midnight, ends before midnight
$d[$day_num]["data"][] = $start_str . "~" . $end_str;
break;
case "> = ":
// Starts after midnight, ends at midnight
$d[$day_num]["data"][] = $start_str . "~24:00";
break;
case "> > ":
// Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = $start_str . "~====>";
break;
示例4: htmlspecialchars
// Starts before today, ends before midnight
$d[$day_num]["data"][] = "<====~" . htmlspecialchars(utf8_strftime(hour_min_format(), $row['end_time']));
break;
case "< = ":
// Starts before today, ends at midnight
$d[$day_num]["data"][] = "<====" . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$d[$day_num]["data"][] = "<====" . $all_day . "====>";
break;
}
} else {
$start_str = period_time_string($row['start_time']);
$end_str = period_time_string($row['end_time'], -1);
switch (cmp3($row['start_time'], $am7[$day_num]) . cmp3($row['end_time'], $pm7[$day_num] + 1)) {
case "> < ":
// Starts after midnight, ends before midnight
// Starts after midnight, ends before midnight
case "= < ":
// Starts at midnight, ends before midnight
$d[$day_num]["data"][] = $start_str . "~" . $end_str;
break;
case "> = ":
// Starts after midnight, ends at midnight
$d[$day_num]["data"][] = $start_str . "~24:00";
break;
case "> > ":
// Starts after midnight, continues tomorrow
$d[$day_num]["data"][] = $start_str . "~====>";
break;
示例5: cmp2
function cmp2($x, $y)
{
cmp3($x, $y);
cmp3($y, $x);
}
示例6: get_booking_summary
function get_booking_summary($start, $end, $day_start, $day_end)
{
global $enable_periods;
// Use ~ (not -) to separate the start and stop times, because MSIE
// will incorrectly line break after a -.
$separator = '~';
$after_today = "====>";
$before_today = "<====";
$midnight = "24:00";
// need to fix this so it works with AM/PM configurations (and for that matter 24h)
// Localized "all day" text but with non-breaking spaces:
$all_day = preg_replace("/ /", " ", get_vocab("all_day"));
if ($enable_periods) {
$start_str = period_time_string($start);
$end_str = period_time_string($end, -1);
} else {
$start_str = htmlspecialchars(utf8_strftime(hour_min_format(), $start));
$end_str = htmlspecialchars(utf8_strftime(hour_min_format(), $end));
}
switch (cmp3($start, $day_start) . cmp3($end, $day_end + 1)) {
case "> < ":
// Starts after midnight, ends before midnight
// Starts after midnight, ends before midnight
case "= < ":
// Starts at midnight, ends before midnight
$result = $start_str;
// Don't bother showing the end if it's the same as the start period
if ($end_str !== $start_str) {
$result .= $separator . $end_str;
}
break;
case "> = ":
// Starts after midnight, ends at midnight
$result = $start_str . $separator . $midnight;
break;
case "> > ":
// Starts after midnight, continues tomorrow
$result = $start_str . $separator . $after_today;
break;
case "= = ":
// Starts at midnight, ends at midnight
$result = $all_day;
break;
case "= > ":
// Starts at midnight, continues tomorrow
$result = $all_day . $after_today;
break;
case "< < ":
// Starts before today, ends before midnight
$result = $before_today . $separator . $end_str;
break;
case "< = ":
// Starts before today, ends at midnight
$result = $before_today . $all_day;
break;
case "< > ":
// Starts before today, continues tomorrow
$result = $before_today . $all_day . $after_today;
break;
}
return $result;
}