本文整理汇总了PHP中array_comb函数的典型用法代码示例。如果您正苦于以下问题:PHP array_comb函数的具体用法?PHP array_comb怎么用?PHP array_comb使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了array_comb函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gmgetdate
function gmgetdate($ts = null){
//echo $ts;
$k = array('seconds','minutes','hours','mday','wday','mon','year','yday','weekday','month',0);
return(array_comb($k,split(":",gmdate('m/d/y H:i:s',is_null($ts)?time():$ts))));
//return date_format($ts, "m/d/y H:i:s");
//return date('m/d/Y H:i:s', $ts);
}
示例2: gmgetdate
function gmgetdate($ts = null)
{
$k = array('seconds', 'minutes', 'hours', 'mday', 'wday', 'mon', 'year', 'yday', 'weekday', 'month', 0);
//split has been deprecated...I think that explode will work here
//return(array_comb($k,split(":",gmdate('s:i:G:j:w:n:Y:z:l:F:U',is_null($ts)?time():$ts))));
return array_comb($k, explode(":", gmdate('s:i:G:j:w:n:Y:z:l:F:U', is_null($ts) ? time() : $ts)));
}
示例3: gmgetdate
function gmgetdate($ts = null)
{
$k = array('seconds', 'minutes', 'hours', 'mday', 'wday', 'mon', 'year', 'yday', 'weekday', 'month', 0);
return array_comb($k, split(":", gmdate('s:i:G:j:w:n:Y:z:l:F:U', is_null($ts) ? time() : $ts)));
}
示例4: ConsistFormat
/**
* Format the field for database insertion.
*
* @param string $field The data from the field to be formated.
* @return string Returns the formated field.
*/
function ConsistFormat(&$field)
{
$f = preg_split('/[\\s,.\\/\\-:]/', strtolower($this->format), -1, PREG_SPLIT_NO_EMPTY);
$v = preg_split('/[\\s,.\\/\\-:]/', $field, -1, PREG_SPLIT_NO_EMPTY);
if (count($f) != count($v)) {
return "''";
}
$dt = array_comb($f, $v);
switch ($this->type) {
case FT_DATE:
return "'" . date('Y-m-d', mktime(0, 0, 0, $dt['m'], $dt['d'], $dt['y'])) . "'";
break;
case FT_TIME:
return "'" . date('H:i:s', mktime($dt['h'], $dt['i'], $dt['s'])) . "'";
break;
case FT_DATETIME:
return "'" . date('Y-m-d H:i:s', mktime($dt['h'], $dt['i'], $dt['s'], $dt['m'], $dt['d'], $dt['y'])) . "'";
break;
}
return "''";
}
示例5: array_comb
Да се напише метод, който сумира 2 масива в трети масив ($c[$i] = $a[$i] + $b[$i]). Двата масива може да са с
различен размер.
*/
function array_comb($a, $b)
{
$c = array();
$a_count = count($a);
$b_count = count($b);
if ($a_count > $b_count) {
for ($i = 0; $i < $a_count; $i++) {
if ($b[$i] == '') {
$b[$i] = 0;
}
$c[$i] = $a[$i] + $b[$i];
}
} else {
for ($i = 0; $i < $b_count; $i++) {
if ($a[$i] == '') {
$a[$i] = 0;
}
$c[$i] = $b[$i] + $a[$i];
}
}
foreach ($c as $key => $value) {
echo '[' . $key . '-' . $value . ']';
}
}
$arr1 = array(5, 8, 16);
$arr2 = array(4, 3, 1, 15, 5);
array_comb($arr1, $arr2);