亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

math函數(shù)

均表達(dá)式中可以使用任何數(shù)值類型的變量,結(jié)果在math 標(biāo)籤的位置輸出.?

表達(dá)式中使用的變數(shù)被當(dāng)作參數(shù)傳遞給函數(shù),可以是模板變數(shù)或靜態(tài)值.?

?目前可以使用的運(yùn)算子有: , -, /, *, abs, ceil, cos, exp, floor, log, log10, max, min, pi, pow, rand, round, sin, sqrt, srans andtan .

#如果指定了"assign" 這個(gè)特殊屬性,該函數(shù)的輸出值將被賦給由assign 指定的模板變量,而不是直接輸出.?

技術(shù)要點(diǎn): 由於使用了php 的eval() 函數(shù),math 函數(shù)的執(zhí)行效率不高. 在PHP 中做數(shù)學(xué)運(yùn)算效率會(huì)更高一些,因此要盡可能在 PHP 中做數(shù)學(xué)運(yùn)算,將結(jié)果賦給模板變數(shù). 類似在 section 循環(huán),應(yīng)明確避免反復(fù)調(diào)用 math 函數(shù).

eg:

{* $height=4, $width=5 *}
{math equation="x y " x=$height y=$width}
輸出:
9


{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
{math equation="height * width / division"
height=$row_height
width=$row_width
division=#col_div#}
#輸出:
100


{* you can use parenthesis *}
{math equation="(( x y ) / z )" x=2 y=10 z= 2}
#輸出:
6


{* you can supply a format parameter in sprintf format *}
{math equation="x y" x =4.4444 y=5.0000 format="%.2f"}
#輸出:
9.44

########################################
繼續(xù)學(xué)習(xí)
||
<?php echo "math函數(shù)";
提交重置程式碼