本文整理汇总了PHP中r_trim函数的典型用法代码示例。如果您正苦于以下问题:PHP r_trim函数的具体用法?PHP r_trim怎么用?PHP r_trim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了r_trim函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: r_trim
function r_trim($array)
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$array[$key] = r_trim($value);
} else {
$array[$key] = trim($value);
}
}
return $array;
}
示例2: time
// get default note's numberplanid and next number
$note['cdate'] = time();
$note['paytime'] = $CONFIG['notes']['paytime'];
if (isset($_GET['customerid']) && $_GET['customerid'] != '' && $LMS->CustomerExists($_GET['customerid'])) {
$customer = $LMS->GetCustomer($_GET['customerid'], true);
$note['numberplanid'] = $DB->GetOne('SELECT n.id FROM numberplans n
JOIN numberplanassignments a ON (n.id = a.planid)
WHERE n.doctype = ? AND n.isdefault = 1 AND a.divisionid = ?', array(DOC_DNOTE, $customer['divisionid']));
}
if (empty($note['numberplanid'])) {
$note['numberplanid'] = $DB->GetOne('SELECT id FROM numberplans
WHERE doctype = ? AND isdefault = 1', array(DOC_DNOTE));
}
break;
case 'additem':
$itemdata = r_trim($_POST);
$itemdata['value'] = f_round($itemdata['value']);
$itemdata['description'] = $itemdata['description'];
if ($itemdata['value'] > 0 && $itemdata['description'] != '') {
$itemdata['posuid'] = (string) getmicrotime();
$contents[] = $itemdata;
}
break;
case 'deletepos':
if (sizeof($contents)) {
foreach ($contents as $idx => $row) {
if ($row['posuid'] == $_GET['posuid']) {
unset($contents[$idx]);
}
}
}
示例3: trans
$error['number'] = trans('Credit note number $a already exists!', $cnote['number']);
}
}
// finally check if selected customer can use selected numberplan
$divisionid = !empty($cnote['use_current_division']) ? $invoice['current_divisionid'] : $invoice['divisionid'];
if ($cnote['numberplanid'] && !$DB->GetOne('SELECT 1 FROM numberplanassignments
WHERE planid = ? AND divisionid = ?', array($cnote['numberplanid'], $divisionid))) {
$error['number'] = trans('Selected numbering plan doesn\'t match customer\'s division!');
}
break;
case 'save':
if (empty($contents) || empty($cnote)) {
break;
}
$SESSION->restore('invoiceid', $invoice['id']);
$newcontents = r_trim($_POST);
foreach ($contents as $item) {
$idx = $item['itemid'];
$contents[$idx]['taxid'] = isset($newcontents['taxid'][$idx]) ? $newcontents['taxid'][$idx] : $item['taxid'];
$contents[$idx]['prodid'] = isset($newcontents['prodid'][$idx]) ? $newcontents['prodid'][$idx] : $item['prodid'];
$contents[$idx]['jm'] = isset($newcontents['jm'][$idx]) ? $newcontents['jm'][$idx] : $item['jm'];
$contents[$idx]['count'] = isset($newcontents['count'][$idx]) ? $newcontents['count'][$idx] : $item['count'];
$contents[$idx]['discount'] = str_replace(',', '.', isset($newcontents['discount'][$idx]) ? $newcontents['discount'][$idx] : $item['discount']);
$contents[$idx]['pdiscount'] = 0;
$contents[$idx]['vdiscount'] = 0;
$contents[$idx]['discount_type'] = isset($newcontents['discount_type'][$idx]) ? $newcontents['discount_type'][$idx] : $item['discount_type'];
if (preg_match('/^[0-9]+(\\.[0-9]+)*$/', $contents[$idx]['discount'])) {
$contents[$idx]['pdiscount'] = $contents[$idx]['discount_type'] == DISCOUNT_PERCENTAGE ? floatval($contents[$idx]['discount']) : 0;
$contents[$idx]['vdiscount'] = $contents[$idx]['discount_type'] == DISCOUNT_AMOUNT ? floatval($contents[$idx]['discount']) : 0;
}
if ($contents[$idx]['pdiscount'] < 0 || $contents[$idx]['pdiscount'] > 99.90000000000001 || $contents[$idx]['vdiscount'] < 0) {