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


PHP format_number函数代码示例

本文整理汇总了PHP中format_number函数的典型用法代码示例。如果您正苦于以下问题:PHP format_number函数的具体用法?PHP format_number怎么用?PHP format_number使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了format_number函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 function display()
 {
     global $mod_strings, $app_list_strings;
     $this->displayPopupHtml();
     // Contract Value:
     $html = '
             <table cellpadding="0" cellspacing="0" border="1" width="100%" style="border-collapse:collapse" class="table_clone" id="contract_value">
                 <thead>
                     <tr bgcolor="#CCCCCC">
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_SERVICE'] . '</th>
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_SOLUONG'] . '</th> 
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_GIATOUR'] . '</th>
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_THUE'] . '</th>
                         <th align="center"> ' . $mod_strings['LBL_CONTRACT_THANHTIEN'] . '</th>
                         <th align="center">&nbsp;</th>
                     </tr>
                 </thead>
                 <tbody>
         ';
     $html .= $this->bean->get_contract_values_detailview();
     $html .= '</tbody>
                     </table>';
     $this->dv->ss->assign("contract_value", $html);
     // Contract Condition:
     $html = '
               <table cellpadding="0" cellspacing="0" border="0" width="100%" class="table_clone" id="contract_condition">
                     <tbody>
         ';
     $html .= $this->bean->get_contract_condition_detailview();
     $html .= '</tbody>
                     </table>';
     $this->dv->ss->assign("contract_condition", $html);
     $this->dv->ss->assign("tongtien", format_number($this->bean->tongtien));
     parent::display();
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:35,代码来源:view.detail.php

示例2: print_states

function print_states($tracker)
{
    global $rulescnt;
    $rulesid = "";
    $bytes = 0;
    $states = 0;
    $packets = 0;
    $evaluations = 0;
    $stcreations = 0;
    $rules = get_pf_rules($rulescnt, $tracker);
    if (is_array($rules)) {
        foreach ($rules as $rule) {
            $bytes += $rule['bytes'];
            $states += $rule['states'];
            $packets += $rule['packets'];
            $evaluations += $rule['evaluations'];
            $stcreations += $rule['state creations'];
            if (strlen($rulesid) > 0) {
                $rulesid .= ",";
            }
            $rulesid .= "{$rule['id']}";
        }
    }
    printf("<a href=\"diag_dump_states.php?ruleid=%s\" data-toggle=\"popover\" data-trigger=\"hover focus\" title=\"%s\" ", $rulesid, gettext("States details"));
    printf("data-content=\"evaluations: %s<br>packets: %s<br>bytes: %s<br>states: %s<br>state creations: %s\" data-html=\"true\">", format_number($evaluations), format_number($packets), format_bytes($bytes), format_number($states), format_number($stcreations));
    printf("%d/%s</a><br>", format_number($states), format_bytes($bytes));
}
开发者ID:NewEraCracker,项目名称:pfsense,代码行数:27,代码来源:firewall_rules.php

示例3: display

 /**
  * @see DashletGenericChart::display()
  */
 public function display()
 {
     global $current_user, $sugar_config;
     require_once 'include/SugarCharts/SugarChartFactory.php';
     $sugarChart = SugarChartFactory::getInstance();
     $sugarChart->base_url = array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search');
     //fixing bug #27097: The opportunity list is not correct after drill-down
     //should send to url additional params: start range value and end range value
     $sugarChart->url_params = array('start_range_date_closed' => $this->pbss_date_start, 'end_range_date_closed' => $this->pbss_date_end);
     $sugarChart->group_by = $this->constructGroupBy();
     $sugarChart->setData($this->getChartData($this->constructQuery()));
     $sugarChart->is_currency = true;
     $sugarChart->thousands_symbol = translate('LBL_OPP_THOUSANDS', 'Charts');
     $currency_symbol = $sugar_config['default_currency_symbol'];
     if ($current_user->getPreference('currency')) {
         $currency = BeanFactory::getBean('Currencies', $current_user->getPreference('currency'));
         $currency_symbol = $currency->symbol;
     }
     $subtitle = translate('LBL_OPP_SIZE', 'Charts') . " " . $currency_symbol . "1" . translate('LBL_OPP_THOUSANDS', 'Charts');
     $pipeline_total_string = translate('LBL_TOTAL_PIPELINE', 'Charts') . $sugarChart->currency_symbol . format_number($sugarChart->getTotal(), 0, 0, array('convert' => true)) . $sugarChart->thousands_symbol;
     if ($this->pbss_chart_type == 'hbar') {
         $sugarChart->setProperties($pipeline_total_string, $subtitle, 'horizontal group by chart');
     } else {
         $sugarChart->setProperties($pipeline_total_string, $subtitle, 'funnel chart 3D');
     }
     $xmlFile = $sugarChart->getXMLFileName($this->id);
     $sugarChart->saveXMLFile($xmlFile, $sugarChart->generateXML());
     return $this->getTitle('') . '<div align="center">' . $sugarChart->display($this->id, $xmlFile, '100%', '480', false) . '</div>' . $this->processAutoRefresh();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:32,代码来源:PipelineBySalesStageDashlet.php

示例4: calculate_percentage_change

function calculate_percentage_change($original_value, $new_value)
{
    if ($original_value == 0) {
        return 'undefined';
    }
    return format_number(($new_value - $original_value) / $original_value * 100) . '%';
}
开发者ID:akaplya,项目名称:xhprof.io,代码行数:7,代码来源:helpers.xhprof.inc.php

示例5: format_number

 function &displayList($layout_def)
 {
     //                $global_currency_obj = get_currency();
     $display = format_number($this->displayListPlain($layout_def), 2, 2, array('convert' => true, 'currency_symbol' => true));
     //                $display =  $global_currency_obj->symbol. round($global_currency_obj->convertFromDollar($this->displayListPlain($layout_def)),2);
     return $display;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:7,代码来源:SugarWidgetFieldcurrency.php

示例6: help_status

function help_status()
{
    global $smarty;
    $db_query = "\n\t\t\tSELECT \n\t\t\t\t`round_id`, \n\t\t\t\t`round_engine`, \n\t\t\t\t`name`, \n\t\t\t\t`description`, \n\t\t\t\t`starttime`, \n\t\t\t\t`stoptime`, \n\t\t\t\t`starsystems`, \n\t\t\t\t`planets`, \n\t\t\t\t`resistance`, \n\t\t\t\t`speed`, \n\t\t\t\t`resourcetick`, \n\t\t\t\t`combattick` \n\t\t\tFROM `rounds` \n\t\t\tWHERE `round_id` = '" . $_SESSION['round_id'] . "' \n\t\t\tLIMIT 1";
    $db_result = mysql_query($db_query);
    $round = mysql_fetch_array($db_result, MYSQL_ASSOC);
    $round['speed'] /= 1000;
    // Dynamic attack limit based on elapsed time of current round
    $end_time = 3456000 * $_SESSION['round_speed'];
    $current_time = microfloat() - $round['starttime'];
    $attack_limit = 1 - $current_time / $end_time;
    if ($attack_limit < 0) {
        $attack_limit = 0;
    }
    $round['attack_limit'] = round($attack_limit * 100, 2);
    $round['description'] = nl2br($round['description']);
    $round['starttime'] = format_timestamp($round['starttime']);
    $round['stoptime'] = format_timestamp($round['stoptime']);
    $round['resistance'] = format_number($round['resistance']);
    $round['resourcetick'] = format_time(timeparser($round['resourcetick'] / 1000));
    $round['combattick'] = format_time(timeparser($round['combattick'] / 1000));
    $smarty->assign('round', $round);
    $smarty->display('help_status.tpl');
    exit;
}
开发者ID:WilliamJamesDalrympleWest,项目名称:imperial-kingdoms,代码行数:25,代码来源:help.php

示例7: jquery_item_data

 public function jquery_item_data()
 {
     /* This function is only used to send JSON data back to a jquery function */
     $params = array('where' => array('mcb_inventory.inventory_id' => $this->input->post('inventory_id')));
     $item = $this->mdl_inventory->get($params);
     $array = array('item_name' => $item->inventory_name, 'item_cost' => format_number($item->inventory_unit_price, FALSE), 'item_description' => $item->inventory_description, 'tax_rate_id' => $item->tax_rate_id);
     echo json_encode($array);
 }
开发者ID:Meritxell01,项目名称:prova,代码行数:8,代码来源:inventory.php

示例8: displayListPlain

 function displayListPlain($layout_def)
 {
     //Bug40995
     if ($layout_def['precision'] != '') {
         return format_number(parent::displayListPlain($layout_def), $layout_def['precision'], $layout_def['precision']);
     } else {
         return format_number(parent::displayListPlain($layout_def), 2, 2);
     }
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:9,代码来源:SugarWidgetFielddecimal.php

示例9: formatField

 /**
  * format the currency field based on system locale values for currency
  * Note that this may be different from the precision specified in the vardefs.
  * @param string $rawfield value of the field
  * @param string $somewhere vardef for the field being processed
  * @return number formatted according to currency settings
  */
 public function formatField($rawField, $vardef)
 {
     // for currency fields, use the user or system precision, not the precision in the vardef
     //this is achived by passing in $precision as null
     $precision = null;
     if ($rawField === '' || $rawField === NULL) {
         return '';
     }
     return format_number($rawField, $precision, $precision);
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:17,代码来源:SugarFieldCurrency.php

示例10: format_file_size

function format_file_size($size)
{
    $b = -1;
    $units = array("kB", "MB", "GB", "TB", "PB", "EB");
    do {
        $size = $size / 1024;
        $b++;
    } while ($size > 99);
    return format_number(floor($size * 100) / 100, 2) . $units[$b];
}
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:10,代码来源:format.inc.php

示例11: formatField

 public function formatField($rawField, $vardef)
 {
     if (!empty($vardef['disable_num_format'])) {
         return $rawField;
     }
     if ($rawField === '' || $rawField === NULL) {
         return '';
     }
     return format_number($rawField, 0, 0);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:10,代码来源:SugarFieldInt.php

示例12: data

 public function data()
 {
     $access = strtolower($this->module . '.' . __CLASS__ . '.' . __FUNCTION__);
     $this->permission->check_permission($access);
     $data['count'] = format_number($this->mp->count_data());
     $data['sidebar_active'] = 'keuangan';
     $data['title'] = 'Keuangan - Data Kasbon';
     $data['content'] = $this->load->view('/data_kasbon', $data, TRUE);
     $this->load->view('template', $data);
 }
开发者ID:ahmadsm,项目名称:iwakkoicenter,代码行数:10,代码来源:kasbon.php

示例13: displayList

 function displayList($layout_def)
 {
     $vardef = $this->getVardef($layout_def);
     if (isset($vardef['precision'])) {
         $precision = $vardef['precision'];
     } else {
         $precision = null;
     }
     return format_number(parent::displayListPlain($layout_def), $precision, $precision);
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:10,代码来源:SugarWidgetFieldfloat.php

示例14: display_currency

function display_currency($amount, $standardize_number = TRUE)
{
    global $CI;
    $amount = format_number($amount, $standardize_number);
    if ($CI->mdl_mcb_data->setting('currency_symbol_placement') == 'before') {
        $amount = $CI->mdl_mcb_data->setting('currency_symbol') . ' ' . $amount;
    } else {
        $amount = $amount . ' ' . $CI->mdl_mcb_data->setting('currency_symbol');
    }
    return $amount;
}
开发者ID:roxio,项目名称:MyClientBase-SB,代码行数:11,代码来源:mcb_currency_helper.php

示例15: testFormatNumber

 public function testFormatNumber()
 {
     $this->assertSame('100', format_number(100));
     $this->assertSame('1.000', format_number(1000));
     $this->assertSame('3.000.000', format_number(3000000));
     $this->assertSame('10', format_number(10.3));
     $this->assertSame('10,34', format_number(10.34234, 2));
     $this->assertSame('13.340,34', format_number(13340.34234, 2));
     $this->assertSame('123.456.789,3456', format_number(123456789.3456, 4));
     $this->assertSame('123,456,789.3456', format_number(123456789.3456, 4, '.', ','));
 }
开发者ID:matriphe,项目名称:format,代码行数:11,代码来源:FormatHelperTest.php


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