本文整理匯總了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) {