四捨五入をする
round関数を用いて「round(値,桁指定)」のように指定します。
桁を指定していない場合は小数点以下の四捨五入となります。
桁指定をした場合
プラスの引数での指定
「1,2,3」等プラスの引数を指定すると小数点第何位までを表示するかの指定が出来ます。
「1」を指定した場合は小数点以下1桁を残す形で、3.1415 が3.1になり
「2」を指定した場合は小数点以下2桁を残す形となり、3.14となります。
マイナスの引数での指定
上記と反対に「-1,-2,-3」とマイナスの引数で指定した場合は整数の何桁以上で四捨五入するかの指定となります。
「-1」を指定した場合は1の桁が四捨五入され1555が1560となり
「-2」を指定した場合は10の桁が四捨五入され1555が1600となります。
実際のコードと出力内容
$a = 3.1415;
echo round($a);
// >>> 3
echo round($a , 1);
// >>> 3.1
echo round($a , 2);
// >>> 3.14
$b = 1555;
echo round($b , -1);
// >>> 1560
echo round($b , -2);
// >>> 1600
切り上げをする
ceil関数を使う事で小数点以下を切り上げた数値を取得出来ます。
round関数と違い桁を指定する事は出来ないので小数点にのみ有効です。
切り下げをする
floor関数を使う事で小数点以下の切り下げた数値を取得出来ます。 ceil関数同様に、桁の指定は出来ません。
整数の切り上げ、切り捨てを行いたい場合は、ceil関数やfloor関数をそのままことが使う事ができないため、一度切り捨て(上げ)したい桁数が小数点以下になるよう調整する必要があります。
$b = 1555;
echo ceil(($b / 100) * 100);
// >>> 1600
echo floor(($b / 100) * 100);
// >>> 1500
cialis 100mg from china
cialis 100mg from china
medco pharmacy lipitor
medco pharmacy lipitor
ventolin inhaler inhouse pharmacy
ventolin inhaler inhouse pharmacy
cialis strips
cialis strips
sildenafil 25 mg buy online
sildenafil 25 mg buy online
buy cheapest cialis
buy cheapest cialis
discount viagra pharmacy
discount viagra pharmacy
mantra 10 tadalafil tablets
mantra 10 tadalafil tablets
rx pharmacy online
rx pharmacy online
buy generic viagra online with paypal
buy generic viagra online with paypal
buy viagra soft tabs online
buy viagra soft tabs online
how can i get viagra in canada
how can i get viagra in canada
generic viagra online uk
generic viagra online uk
discount viagra canadian pharmacy
discount viagra canadian pharmacy
sildenafil 25 mg daily
sildenafil 25 mg daily
tadalafil temperature
tadalafil temperature
free tadalafil
free tadalafil
tadalafil use in females
tadalafil use in females
when is generic cialis available
when is generic cialis available
neurontin hyperkalemia
neurontin hyperkalemia
flagyl storage
flagyl storage
trimethoprim/sulfamethoxazole ds for sinus infection
trimethoprim/sulfamethoxazole ds for sinus infection
nolvadex dischem
nolvadex dischem
lyrica narcotic controlled substance
lyrica narcotic controlled substance
valacyclovir dizziness
valacyclovir dizziness
lisinopril promethazine
lisinopril promethazine
furosemide vancomycin
furosemide vancomycin
médicament ratio-metformin
médicament ratio-metformin
empower pharmacy semaglutide reddit
empower pharmacy semaglutide reddit
semaglutide other names
semaglutide other names
semaglutide cyanocobalamin
semaglutide cyanocobalamin
how long does it take zoloft to get out of your system
how long does it take zoloft to get out of your system
flagyl intraveineuse
flagyl intraveineuse
duloxetine hcl dr 20 mg
duloxetine hcl dr 20 mg
cymbalta side effects how long do they last
cymbalta side effects how long do they last
can adderall be take with escitalopram oral
can adderall be take with escitalopram oral
cephalexin make you sleepy
cephalexin make you sleepy
sildenafil 20 mg tablet brand name
sildenafil 20 mg tablet brand name
does lexapro make you gain weight
does lexapro make you gain weight
can you take bactrim and keflex together
can you take bactrim and keflex together
fluoxetine is generic for what
fluoxetine is generic for what
gabapentin litigation
gabapentin litigation
cephalexin for fish
cephalexin for fish
ciprofloxacin and tylenol
ciprofloxacin and tylenol
does bactrim treat chlamydia
does bactrim treat chlamydia
what does bactrim look like
what does bactrim look like
My coder is trying to persuade me to move to .net from PHP.
I have always disliked the idea because of the expenses.
But he's tryiong none the less. I've been using Movable-type
on a variety of websites for about a year and am concerned about switching to another platform.
I have heard good things about blogengine.net.
Is there a way I can import all my wordpress posts into it?
Any help would be greatly appreciated!
my website: chocolate shrooms
Today, I went to the beach front with my kids.
I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her
ear and screamed. There was a hermit crab inside and it
pinched her ear. She never wants to go back! LoL
I know this is entirely off topic but I had to tell
someone!
my site ... amanita muscaria mushroom
flomax after turp surgery
flomax after turp surgery
ddavp test von willebrand
ddavp test von willebrand
is amoxicillin a penicillin
is amoxicillin a penicillin
diltiazem side effects mayo clinic
diltiazem side effects mayo clinic
depakote er dosage
depakote er dosage
does flexeril show up on drug test
does flexeril show up on drug test
contrave and zoloft reddit
contrave and zoloft reddit
how long for effexor to work
how long for effexor to work
who makes cozaar
who makes cozaar
what antihistamine can i take with citalopram
what antihistamine can i take with citalopram
efectos adversos del ezetimibe
efectos adversos del ezetimibe
augmentin es 600
augmentin es 600
diclofenac potassium side effects
diclofenac potassium side effects
nortriptyline vs amitriptyline
nortriptyline vs amitriptyline
buffered aspirin for dogs
buffered aspirin for dogs
side effects of allopurinol 300 mg
side effects of allopurinol 300 mg
aripiprazole price walmart
aripiprazole price walmart
is celebrex safe to take
is celebrex safe to take
another name for celexa
another name for celexa
bupropion medication
bupropion medication
can you snort baclofen 10 mg
can you snort baclofen 10 mg
celecoxib (celebrex)
celecoxib (celebrex)
how long does buspar last
how long does buspar last
ashwagandha during pregnancy
ashwagandha during pregnancy
abilify maintena 400 mg
abilify maintena 400 mg
seroquel and remeron
seroquel and remeron
repaglinide metformin hplc
repaglinide metformin hplc
protonix coupon
protonix coupon
is robaxin a good muscle relaxer
is robaxin a good muscle relaxer
acarbose carcinogenicity
acarbose carcinogenicity
what are the long term side effects of semaglutide
what are the long term side effects of semaglutide
actos rcp
actos rcp
tizanidine and gabapentin
tizanidine and gabapentin
does voltaren have carbs
does voltaren have carbs
sitagliptin 100 mg price in india
sitagliptin 100 mg price in india
fluconazole synthroid
fluconazole synthroid
how to wean off venlafaxine 75 mg
how to wean off venlafaxine 75 mg
medikament tamsulosin esparma
medikament tamsulosin esparma
joint pain spironolactone
joint pain spironolactone
stromectol tablets uk
stromectol tablets uk