本文整理汇总了PHP中AppHelper::getTotals方法的典型用法代码示例。如果您正苦于以下问题:PHP AppHelper::getTotals方法的具体用法?PHP AppHelper::getTotals怎么用?PHP AppHelper::getTotals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppHelper
的用法示例。
在下文中一共展示了AppHelper::getTotals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert_number_to_words
public static function convert_number_to_words($number)
{
$number = AppHelper::getTotals();
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative = 'negative ';
$decimal = ' point ';
$dictionary = array(0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 9 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 19 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 21 => 'twenty-one', 22 => 'twenty-two', 23 => 'twenty-three', 24 => 'twenty-four', 25 => 'twenty-five', 26 => 'twenty-six', 27 => 'twenty-seven', 28 => 'twenty-eight', 29 => 'twenty-nine', 30 => 'thirty', 31 => 'thirty-one', 32 => 'thirty-two', 33 => 'thirty-three', 34 => 'thirty-four', 35 => 'thirty-five', 36 => 'thirty-six', 37 => 'thirty-seven', 38 => 'thirty-eight', 39 => 'thirty-nine', 40 => 'fourty', 41 => 'fourty-one', 42 => 'fourty-two', 43 => 'fourty-three', 44 => 'fourty-four', 45 => 'fourty-five', 46 => 'fourty-six', 47 => 'fourty-seven', 48 => 'fourty-eight', 49 => 'fourty-nine', 50 => 'fifty', 51 => 'fifty-one', 52 => 'fifty-two', 53 => 'fifty-three', 54 => 'fifty-four', 55 => 'fifty-five', 56 => 'fifty-six', 57 => 'fifty-seven', 58 => 'fifty-eight', 59 => 'fifty-nine', 60 => 'sixty', 61 => 'sixty-one', 62 => 'sixty-two', 63 => 'sixty-three', 64 => 'sixty-four', 65 => 'sixty-five', 66 => 'sixty-six', 67 => 'sixty-seven', 68 => 'sixty-eight', 69 => 'sixty-nine', 70 => 'seventy', 71 => 'seventy-one', 72 => 'seventy-two', 73 => 'seventy-three', 74 => 'seventy-four', 75 => 'seventy-five', 76 => 'seventy-six', 77 => 'seventy-seven', 78 => 'seventy-eight', 79 => 'seventy-nine', 80 => 'eighty', 81 => 'eighty-one', 82 => 'eighty-two', 83 => 'eighty-three', 84 => 'eighty-four', 85 => 'eighty-five', 86 => 'eighty-six', 87 => 'eighty-seven', 88 => 'eighty-eight', 89 => 'eighty-nine', 90 => 'ninety', 91 => 'ninety-one', 92 => 'ninety-two', 93 => 'ninety-three', 94 => 'ninety-four', 95 => 'ninety-five', 96 => 'ninety-six', 97 => 'ninety-seven', 98 => 'ninety-eight', 99 => 'ninety-nine', 100 => 'hundred', 1000 => 'thousand', 100000 => 'lac', 10000000 => 'crore');
if (!is_numeric($number)) {
return false;
}
if ($number >= 0 && (int) $number < 0 || (int) $number < 0 - PHP_INT_MAX) {
// overflow
trigger_error('convert_number_to_words only accepts numbers between -' . PHP_INT_MAX . ' and ' . PHP_INT_MAX, E_USER_WARNING);
return false;
}
if ($number < 0) {
return $negative . abs($number);
}
$string = $fraction = null;
if (strpos($number, '.') !== false) {
list($number, $fraction) = explode('.', $number);
}
switch (true) {
case $number < 100:
$string = $dictionary[$number];
break;
case $number < 1000:
$hundreds = $number / 100;
$remainder = $number % 100;
$string = $dictionary[$hundreds] . ' ' . $dictionary[100];
if ($remainder < 100) {
$remainder = $dictionary[$remainder];
$string .= $conjunction . $remainder;
}
break;
case $number < 100000:
$thousand = $number / 1000;
$remainder = $number % 1000;
$string = $dictionary[$thousand] . ' ' . $dictionary[1000];
if ($remainder > 100 && $remainder < 1000) {
//$remainder = $number % 100;
$hundreds = $remainder / 100;
$remainder = $remainder % 100;
//return $hundreds=$dictionary[$hundreds] . ' ' . $dictionary[100];
$remainder = $dictionary[$remainder];
$string .= $conjunction . $dictionary[$hundreds] . ' ' . $dictionary[100] . ' ' . $remainder;
} elseif ($remainder < 100) {
//$remainder = $number % 100;
$string .= $conjunction . $dictionary[$remainder];
}
break;
case $number < 10000000:
$lac = $number / 100000;
$remainder = $number % 100000;
$string = $dictionary[$lac] . ' ' . $dictionary[100000];
if ($remainder < 100000) {
//$remainder = $number % 100;
$thousand = $remainder / 1000;
$hundred_remainder = $remainder % 1000;
$hundreds = $hundred_remainder / 100;
$ten_reminder = $hundred_remainder % 100;
//$remainder=$remainder%1000;
$hundreds = $dictionary[$hundreds];
$thousand = $dictionary[$thousand];
$tens = $dictionary[$ten_reminder];
//$string .= $conjunction .$dictionary[$thousand];
$string .= $conjunction . $thousand . ' ' . $dictionary[1000] . ' ' . $hundreds . ' ' . $dictionary[100] . ' ' . $tens;
}
break;
case $number < 1000000000:
$crore = $number / 10000000;
$remainder = $number % 10000000;
$string = $dictionary[$crore] . ' ' . $dictionary[10000000];
if ($remainder < 10000000) {
$lac = $remainder / 100000;
$lac_remainder = $remainder % 100000;
$thousand = $lac_remainder / 1000;
$hundred_remainder = $lac_remainder % 1000;
$hundreds = $hundred_remainder / 100;
$ten_reminder = $hundred_remainder % 100;
//$remainder=$remainder%1000;
$lac = $dictionary[$lac];
$hundreds = $dictionary[$hundreds];
$thousand = $dictionary[$thousand];
$tens = $dictionary[$ten_reminder];
//$string .= $conjunction .$dictionary[$thousand];
$string .= $conjunction . $lac . ' ' . $dictionary[100000] . $conjunction . $thousand . ' ' . $dictionary[1000] . ' ' . $hundreds . ' ' . $dictionary[100] . ' ' . $tens;
}
break;
}
if (null !== $fraction && is_numeric($fraction)) {
$string .= $decimal;
$words = array();
foreach (str_split((string) $fraction) as $number) {
$words[] = $dictionary[$number];
}
$string .= implode(' ', $words);
}
//.........这里部分代码省略.........
示例2:
4th Part<b> :</b> <b>Depositor</b><span class="space-form-depositor">Form No.<b> : {{AppHelper::getFormID()}}</b></span>
<div class="space-bank-name"><h1>Pubali Bank Ltd.</h1></div>
<div class="space-bank-name-branch"><h5>Dhaka Bar Library Branch, Dhaka.</h5></div>
<div class="space-form-date"><h5>Date <b>: .............................</b></h5></div>
<h5>As per particulars overleaf the amount is deposited into the Collection<b> Account No. 4910</b> of the Dhaka Bar Association standing in the Pubali Bank,Dhaka Bar Library Branch,Dhaka.</h5>
<br/>
<div>
Taka<b> : {{AppHelper::getTotals()}} Taka</b>
</div>
<br/>
<div>
In Word<b> : <?php
echo AppHelper::convert_number_to_words(AppHelper::getTotals());
?>
Taka</b>
</div>
<br/>
<div>
Scroll No.<b> : .....................................................</b>
</div>
<br/>
<div>
Main Cashier<b> : ................................................</b>
</div>
<br/>
<div>
Scroll Cash.<b> : ..................................................</b>