本文整理汇总了PHP中total函数的典型用法代码示例。如果您正苦于以下问题:PHP total函数的具体用法?PHP total怎么用?PHP total使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了total函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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'];
?>
示例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();
//}
}
示例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
示例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;
}
示例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 ">
示例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");
示例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>
示例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>";
示例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();
?>
示例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>
示例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();
}
示例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>
示例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;
}
}
}
示例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;
}