今天用到PHP與JavaScript四捨五入函數,PHP寫過,JavaScript沒寫過,先記下!!
PHP:
float round ( float $val [, int $precision= 0 [, int $mode= PHP_ROUND_HALF_UP ]] )
Ex:
round (3.4)—->3
round (3.5)—->4
JavaScript:
Math.round()
今天用到PHP與JavaScript四捨五入函數,PHP寫過,JavaScript沒寫過,先記下!!
PHP:
float round ( float $val [, int $precision= 0 [, int $mode= PHP_ROUND_HALF_UP ]] )
Ex:
round (3.4)—->3
round (3.5)—->4
JavaScript:
Math.round()