The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Rounding?
How would you get a number to round if it went into a decimal, like let's say I have 100.2, how would i get that to automatically go to 100? Or is there not a way?
|
#2
|
||||
|
||||
PHP's round() function, or sprintf() for older versions.
|
#3
|
||||
|
||||
Thanks ^^
But umm.. with the round how would I use it? Like how would I get it to know that it goes a decimal over to round up to the nearest 1? |
#4
|
|||
|
|||
You can use something like this:
PHP Code:
|
#5
|
||||
|
||||
Vincent]So if I did
PHP Code:
PHP Code:
|
#6
|
|||
|
|||
Correct. The round() function will always go to the nearest integer, while ceil() and floor() round up and down, respectively.
|
#7
|
||||
|
||||
What if blah1 ended up being 205 and didn't have a decimal? Then what would happen?
|
#8
|
||||
|
||||
If the number you are rounding is already an integer, it will stay the same.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|