php round() function
Translation results:
英[raʊnd] 美[raʊnd]
adj. Round; arc-shaped; plump, fat; integer
adv. Everywhere; around; roundabout ; in the opposite direction
prep.approximately; around, surrounding; (indicating position) around; nearby
n. circle, circle; cycle; round object, spherical object; (Meeting) One round
Third person singular: rounds Plural: rounds Present participle: rounding Past tense: rounded Past participle: rounded Comparative: rounder Superlative: roundest
php round() functionsyntax
Function: The round() function is used to round floating point numbers
Syntax: round(X,prec)
Parameters:
Parameters | Description |
X | To be done Processed numbers |
prec | Specify the number of digits after the decimal point |
Description: Return the result of rounding parameter X according to the number of digits after the decimal point prec. prec can be a negative number or 0, and 0 is the default value.
php round() functionexample
<?php $i = 1.56; $i = round($i,2); $j = 5.25; $j = round($j,-1); $k = -5.35; $k = round($k); echo $i."*****".$j."*****".$k; ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
1.56*****10*****-5
<?php $i = -5.6; $j = round($i); echo $j; ?>
Run Instance»
Click the "Run Instance" button to view the online instance
Output:
-6
Popular Recommendations
- Litecoin Round-Trips 2024 Gains as Crypto Rally Deflates
- Polymarket Eyes $50M Funding Round, Considers Launching Token as Crypto Market Recovers
- Celestia Foundation Raises $100M in Funding Round to Drive Innovation in Blockchain Scalability and Accessibility
- Depot After Dark: Fields Coin Toss, Steelers Business Trip, Former First-Round Picks Suit Up
- Chaos Labs Gains Recognition for Its DeFi Risk Management Tools, Secures $55M Series A Funding Round
- Rare £1 coins: The 12 most valuable round pound coins in circulation and how much they are worth