本文整理汇总了PHP中total函数的典型用法代码示例。如果您正苦于以下问题:PHP total函数的具体用法?PHP total怎么用?PHP total使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了total函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load
function load($num)
{
$connection = mysqli_connect("*****", "*****", "*****", "*****");
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
$max = total();
do {
$new = rand(1, $max);
} while ($new == $num);
$sql = "select * from ***** where id='{$new}'";
$result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
$temparray = array();
while ($row = mysqli_fetch_assoc($result)) {
$temparray[] = $row;
}
echo json_encode($temparray);
}
开发者ID:kvelcich,项目名称:goalvotes,代码行数:18,代码来源:functions.php
示例2: foreach
<th>Product</th>
<th></th>
<th>Price</th>
<th>Quantity</th>
</thead>
<tbody>
<?php
$i = 0;
$s = 's';
$subtotal = 0;
if ($cart != NULL) {
$i = 0;
$s = 's';
foreach ($cart as $prod) {
$product = db_get_product_by_id($prod['item#']);
$subtotal = total($cart);
$quantity = $prod['quantity'];
?>
<tr>
<td><img class="sml" src="<?php
echo $product['image'];
?>
"/></td>
<td>
<h4><?php
echo $product['brand'] . ' ' . $product['name'];
?>
</h4>
<p><?php
echo $product['brand'];
?>
开发者ID:Naisargi1,项目名称:YarnStore,代码行数:31,代码来源:cart_page.php
示例3: main
function main()
{
$tests = array("simple", "simplecall", "simpleucall", "simpleudcall", "mandel", "ackermann", "ary", "ary2", "ary3", "fibo", "hash2", "heapsort", "nestedloop", "sieve", "strcat", "binary_trees", "fannkuch", "fasta", "mandelbrot", "meteor_contest", "n_body", "spectral_norm");
$t0 = $t = start_test();
foreach ($tests as $test) {
// if (!isset($argv[1]) || $argv[1] === $test) {
$test();
$t = end_test($t, $test);
//}
}
//if (!getenv('VERIFY')) {
total();
//}
}
开发者ID:jemmy655,项目名称:hippyvm,代码行数:14,代码来源:bench.php
示例4: total
echo $cartItem['price'];
?>
</span>
<span class="cart-qty">QTY : <?php
echo $cartItem['qty'];
?>
</span>
<span class="cart-subtotal">SUBTOTAL : <?php
echo $subtotal;
?>
</span>
</span>
<?php
$total += total($subtotal);
?>
</li>
<?php
}
?>
<span class="shipping-price"><h3>Shipping price:</h3><?php
echo $_SESSION['shipping'];
?>
</span>
<span class="cart-total"><h2>ORDER TOTAL : <?php
echo $total + $_SESSION['shipping'];
?>
</h2></span>
<a href="payment.php?ttl=<?php
开发者ID:Substractive,项目名称:student-web-shop,代码行数:31,代码来源:order_preview_page.php
示例5: respuestas
function respuestas($id)
{
$resinfo = mysql_query("SELECT idRespuesta, idSondeo, respuesta\n\t\t\t\t\t\t\t\t\t\t\t\tFROM respuesta");
while ($respreview = mysql_fetch_array($resinfo)) {
if ($id == $respreview['idSondeo']) {
$respuestas[] = array('idRespuesta' => $respreview['idRespuesta'], 'idSondeo' => $respreview['idSondeo'], 'respuesta' => $respreview['respuesta'], 'total' => total($respreview['idRespuesta']));
}
}
return $respuestas;
}
开发者ID:jchavezjs,项目名称:contrapunto,代码行数:10,代码来源:funciones.php
示例6: totalg2
function totalg2()
{
global $db;
$totalg2 = 0;
$idprt = array_keys($_SESSION['guirlande2']);
$produites = implode("','", $idprt);
$totales = $db->query("SELECT id_longueur , prix FROM longueur_guirlande WHERE id_longueur IN ('{$produites}') ");
foreach ($totales as $totale) {
$totalg2 += $totale['prix'] * $_SESSION['guirlande2'][$totale['id_longueur']];
}
return $totalg2;
}
?>
<p class="price_t"> Товаров на сумму: <span><?php
$total_pace = print_r(total() + total2() + total_b() + total_j() + total_j2() + total_g() + totalg2());
?>
руб</span></p>
</div>
<hr/>
<div class="form_panier">
<form method="POST">
<div class="choix_p_t">
<h2>Выбрать Способ оплаты </h2>
<div class="cadrre">
<div class="form-group">
<div class="img_cadrre">
<img src="images/img_cache.png" alt="img_cache">
</div>
<div class="choix_trans ">
开发者ID:kevinpak,项目名称:Elki,代码行数:31,代码来源:shop.php
示例7: end_test
$t = end_test($t, "simpleudcall");
mandel();
$t = end_test($t, "mandel");
mandel2();
$t = end_test($t, "mandel2");
ackermann(7);
$t = end_test($t, "ackermann(7)");
ary(50000);
$t = end_test($t, "ary(50000)");
ary2(50000);
$t = end_test($t, "ary2(50000)");
ary3(2000);
$t = end_test($t, "ary3(2000)");
fibo(30);
$t = end_test($t, "fibo(30)");
hash1(50000);
$t = end_test($t, "hash1(50000)");
hash2(500);
$t = end_test($t, "hash2(500)");
heapsort(20000);
$t = end_test($t, "heapsort(20000)");
matrix(20);
$t = end_test($t, "matrix(20)");
nestedloop(12);
$t = end_test($t, "nestedloop(12)");
sieve(30);
$t = end_test($t, "sieve(30)");
strcat(200000);
$t = end_test($t, "strcat(200000)");
total($t0, "Total");
开发者ID:cefalo19,项目名称:php-src,代码行数:30,代码来源:bench.php
示例8: fclose
}
fclose($file_count);
@(list($today, $yesterday, $total, $date, $days) = split("%", $data));
echo ceil($total / $days);
}
?>
Đang online: <?php
echo online();
?>
<br>
Truy cập hôm nay: <?php
echo today();
?>
<br>
Truy cập hôm qua: <?php
echo yesterday();
?>
<br>
Tổng số truy cập: <?php
total();
?>
<br>
Truy cập trung bình: <?php
avg();
?>
<br>
</td>
</tr>
</table>
开发者ID:loctho1995,项目名称:Web-Bookstore,代码行数:31,代码来源:trai_home.php
示例9: total
$table .= "<td> Q Demand</td>";
for ($i = 0; $i < count($ss['qDemand']); $i++) {
$table .= "<td>" . $ss["qDemand"][$i] . "</td>";
}
$table .= "</tr>";
// body table
$table .= "</table>";
return $table;
}
function total($ss)
{
$demand = $ss["demand"];
$hasilDemand = $ss["hasilDemand"];
$total = 0;
//print_r(json_encode($demand));
for ($h = 0; $h < count($ss['qSupply']); $h++) {
for ($i = 0; $i < count($ss['qDemand']); $i++) {
if ($hasilDemand[$h][$i] > 0) {
$total += $hasilDemand[$h][$i] * $demand[$h][$i];
}
}
}
return $total;
}
function toRp($nilai)
{
return number_format($nilai, 0, '.', ',');
}
echo createViewTable($ss);
echo "<strong>Total : Rp. " . toRp(total($ss)) . "</strong>";
开发者ID:anggakes,项目名称:nwc_stepping_stone,代码行数:30,代码来源:main.php
示例10: mysql_query
<?php
// require common code
require_once "Comon/common.php";
// Index of the last entry
$result = mysql_query("SELECT MAX(`index`) FROM `processos`");
$array = mysql_fetch_row($result);
$index = $array[0];
//Retrinving number of files in each class from current month and
// atribuiting it to a given session variable
$_SESSION["RELATOR"] = total('RELATOR');
$_SESSION["REVISOR"] = total('REVISOR');
$_SESSION["TOTAL"] = $_SESSION["RELATOR"] + $_SESSION["REVISOR"];
?>
<!DOCTYPE html>
<html>
<head>
<title>JP: Processos</title>
<link href="css/index.css" rel="stylesheet" media="screen and (max-height: 800px)">
<link href="css/index-job.css" rel="stylesheet" media="screen and (min-height: 800px)">
<link href="http://fonts.googleapis.com/css?family=Just Me Again Down Here" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Mouse Memoirs" rel="stylesheet" type="text/css">
<meta charset='utf-8'>
</head>
<?php
top_site();
?>
开发者ID:nailton,项目名称:TJ,代码行数:31,代码来源:index.php
示例11: unset
$errorCVC = true;
unset($_SESSION['errorCVC']);
}
if (array_key_exists('errorMY', $_SESSION)) {
$errorMY = true;
unset($_SESSION['errorMY']);
}
if (array_key_exists('errorDate', $_SESSION)) {
$errorDate = true;
unset($_SESSION['errorDate']);
}
}
db_connect();
$user_id = $_GET['user_id'];
$cart = get_cart($user_id);
$total = total($cart);
?>
<h1>Payment</h1>
<div class="stepwizard">
<div class="stepwizard-row">
<div class="stepwizard-step">
<a href="cart_page.php" class="btn btn-default btn-circle">1</a>
<p>Cart</p>
</div>
<div class="stepwizard-step">
<a href="checkout.php" class="btn btn-default btn-circle">2</a>
<p>Shipping</p>
</div>
<div class="stepwizard-step">
<button type="button" class="btn btn-primary btn-circle" >3</button>
开发者ID:Naisargi1,项目名称:YarnStore,代码行数:31,代码来源:payment.php
示例12: Somar
function Somar($var)
{
global $conexao;
$userid = $_SESSION['userid'];
$total = total() + $var;
$comandoSql = "UPDATE usuario SET total = ? WHERE userid = ?";
$stmt = $conexao->prepare($comandoSql) or trigger_error("triggererror " . $conexao->error);
$stmt->bind_param('is', $total, $userid);
$stmt->execute();
$stmt->close();
}
开发者ID:pedradanamente,项目名称:15.3.1,代码行数:11,代码来源:banco.php
示例13: number_format
?>
</td>
<td class="cart-remove"><input type="checkbox" name="remove[]" value="<?php
echo $id;
?>
"></td>
</tr>
<?php
}
?>
<tr class="cart-total">
<td colspan="4">TOTAL</td>
<td class="cart-price">$<?php
echo number_format(total(), 2);
?>
</td>
<td></td>
</tr>
</tbody>
</table>
<div class="cart-submits">
<input type="submit" name="update" value="Update Cart">
<input type="submit" name="checkout" value="Check Out">
</div>
</form>
开发者ID:jupiterhyun,项目名称:project0,代码行数:30,代码来源:cart.php
示例14: is_on
/**
* Verifica se o USUÁRIO está autenticado
*
* @name is_on
* @return bool
*/
function is_on()
{
$login = str($_SESSION["login"]);
$senha = str($_SESSION["senha"]);
$sel = sel("usuarios", "usuario = '{$login}' and senha = '{$senha}'", "", "");
if (total($sel) == 0) {
return false;
} else {
$ids = $_SESSION["idsession"];
$sel = sel("sessoes", "ids = '{$ids}' and usuario = '{$usuario} and senha = '{$senha}'", "", "");
if (total($sel) == 0) {
return false;
} else {
return true;
}
}
}
开发者ID:paico,项目名称:bigboss,代码行数:23,代码来源:bigboss.php
示例15: get_sub_total
/**
* Get cart sub total.
*/
function get_sub_total($cart, $options = null)
{
// Add item totals.
foreach ((array) $cart['items'] as $item) {
$should_add_to_total = !$item['is_cancelled'] && !$item['is_returned'] || $cart['order']['status'] == 'cancelled' || $cart['order']['status'] == 'returned';
if ($should_add_to_total) {
$sub_total += $item['price'] * $item['quantity'];
$sub_cost += $item['cost'] * $item['quantity'];
}
}
// Return sub cost?
if ($options['cost']) {
return $sub_cost;
}
$orig_sub_total = $sub_total;
// Apply discounts.
$sub_total = Discounts::apply_sub_total($cart, $sub_total, $cart['discounts']);
// Discount total?
if ($options['discount']) {
return abs($orig_sub_total - total($sub_total));
}
return $orig_sub_total;
}
开发者ID:kfuchs,项目名称:fwdcommerce,代码行数:26,代码来源:Carts.php
示例16: file
<?php
$file = file('input.txt');
function wrappingPaper($length, $width, $height)
{
$lowest = min([$length * $width, $width * $height, $height * $length]);
return 2 * $length * $width + 2 * $width * $height + 2 * $height * $length + $lowest;
}
function ribbonLength($length, $width, $height)
{
$array = [$length, $width, $height];
sort($array, SORT_NUMERIC);
$ribbon = $array[0] + $array[0] + ($array[1] + $array[1]);
return $length * $width * $height + $ribbon;
}
function total($input)
{
$paper = 0;
$ribbon = 0;
foreach ($input as $present) {
$sides = explode('x', $present);
$paper += wrappingPaper($sides[0], $sides[1], $sides[2]);
$ribbon += ribbonLength($sides[0], $sides[1], $sides[2]);
}
return [$paper, $ribbon];
}
echo $part_1 = total($file)[0] . PHP_EOL;
echo $part_2 = total($file)[1] . PHP_EOL;
开发者ID:Donneh,项目名称:Advent-of-Code,代码行数:28,代码来源:index.php
示例17: total
<?php
//带& 传进来的是变量
function total($dirname, &$dirnum, &$filenum)
{
$dir = opendir($dirname);
readdir($dir) . "<br/>";
//. 代表当前目录
readdir($dir) . "<br/>";
// ..代表上级目录 我们不把. 和..输出 只读
//当文件名存在的时候就将它输出 会把所有的文件和目录输出
while ($filenameaa = readdir($dir)) {
echo $filenameaa . "<br/>";
}
//我们在demo4中用循环的方式来输出所有的文件名
}
$dirnum = 0;
$filennum = 0;
total("E:/xampp/phpMyAdmin", $dirnum, $filenum);
echo "目录总数:" . $dirnum;
echo "目录总数:" . $filennum;
开发者ID:lilili001,项目名称:think,代码行数:21,代码来源:demo4.php
示例18: currencySymbol
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="tax" value="0" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="no_shipping" value="1" />
<div class="dg_body_background_basket_continue_shopping">
<button class="dg_btn" type="button" onclick="javascript:location.href='<?php
echo JRoute::_('index.php?option=com_datsogallery' . $itemid);
?>
';">
<span><span><?php
echo JText::_('COM_DATSOGALLERY_CONTINUE_SHOPPING');
?>
</span></span></button></div> <div class="dg_body_background_basket_subtotal"><?php
echo $showtax;
echo JText::_('COM_DATSOGALLERY_BASKET_TOTAL');
?>
: <?php
echo currencySymbol($ad_pp_currency);
?>
<span id="total"><?php
echo total();
?>
</span><button type="submit" class="dg_btn"><span><span><?php
echo JText::_('COM_DATSOGALLERY_CHECKOUT');
?>
</span></span></button></div>
</form>
</div>
<br />
<br />
<br />
开发者ID:j0rg3m414,项目名称:centerar,代码行数:31,代码来源:datso.checkout.php
示例19: print_r
echo '<pre>';
if (is_array($array)) {
print_r($array);
}
echo '</pre>';
}
}
if (!function_exists('total')) {
function total($array)
{
if (is_array($array)) {
$total = count($array);
echo '<h3>Total: ' . $total . '</h3>';
}
}
}
//Start test
require dirname(__DIR__) . '/font-awesome.class.php';
//Init font awesome
$fa = new Smk_FontAwesome();
$css_path = dirname(__FILE__) . '/font-awesome/css/font-awesome.css';
$icons = $fa->getArray($css_path);
//Total icons
total($icons);
smk_print($icons, 'Basic:');
smk_print($fa->sortByName($icons), 'Sort by key name:');
smk_print($fa->onlyClass($icons), 'Only HTML class, no unicode:');
smk_print($fa->onlyUnicode($icons), 'Only unicode, no HTML class:');
smk_print($fa->readableName($icons), 'Only HTML class, readable:');
$test_fail = $fa->getArray($css_path, 'fail-');
smk_print($fa->readableName($test_fail), 'This test should fail(empty array):');
开发者ID:wstam88,项目名称:SMK-Font-Awesome-PHP-JSON,代码行数:31,代码来源:test.php
示例20: process_default_methods
/**
* Process and validate data for default methods.
*/
function process_default_methods($payment)
{
$settings = get("/settings/payments");
// Adjust amount for refunds/credits.
if (in_array($payment['action'], array('credit', 'refund'))) {
$payment['amount'] = -abs($payment['amount']);
}
switch ($payment['method']) {
// Cash payment.
case 'cash':
$payment['status'] = 'success';
break;
// Credit payment.
// Credit payment.
case 'credit':
if ($payment['action'] == 'charge') {
// Check account balance before charge.
$account = get("/accounts/{$payment['account_id']}");
if ($account['balance'] < $payment['amount']) {
throw new Exception("Account lacks funds (\$" . total($account['balance']) . ")");
}
}
$payment['status'] = 'success';
break;
// Invoice payment.
// Invoice payment.
case 'invoice':
// Default due date based on account terms.
if ($account = get("/accounts/{$payment['account_id']}")) {
// Net days by account terms or default setting.
$net_days = $account['terms']['net_days'] ?: $settings['invoice']['net_days'];
if ($net_days) {
$payment['date_due'] = date('Y-m-d', time() + $net_days * 86400);
}
}
break;
}
return $payment;
}
开发者ID:kfuchs,项目名称:fwdcommerce,代码行数:42,代码来源:Payments.php
注:本文中的total函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论