当前位置: 首页>>代码示例>>PHP>>正文


PHP r_trim函数代码示例

本文整理汇总了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;
}
开发者ID:pcela,项目名称:lms,代码行数:11,代码来源:common.php

示例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]);
                }
            }
        }
开发者ID:repcio,项目名称:lms,代码行数:31,代码来源:noteadd.php

示例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) {
开发者ID:oswida,项目名称:lms,代码行数:31,代码来源:invoicenote.php


注:本文中的r_trim函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。