/    Sign up×
Community /Pin to ProfileBookmark

round number???

hi, i have a script that produces a variable and assigns that variable a number…….but the number’s always got a tonne of decimal places and i wanted to know if there’s a way to turnn this number into a round/whole number before it echo’s it out. ?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 22.2005 — Hmmm....let's see.....

You could try this little function which the PHP developers cleverly called [url=http://www.php.net/round]round()[/url].

?
Copy linkTweet thisAlerts:
@ZiplineDec 22.2005 — round($value,2) Where 2 is the number of decimal places... same function NogDog mentioned just an example of it in action.
Copy linkTweet thisAlerts:
@jamauthorDec 22.2005 — lol, cheers i take it you cantell i'm a complete noob n e way thx.....JAM
×

Success!

Help @jam spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...