Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Easy Date   Perfect Money   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 03-17-2006, 12:56 AM   #1 (permalink)
Contributing Member
 
ATLien's Avatar
 
Join Date: 10-13-03
Location: Atlanta, GA
Posts: 2,279
iTrader: 0 / 0%
Latest Blog:
Flip Mino Review

ATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really niceATLien is just really nice
Send a message via AIM to ATLien
PHP Always Round Up?

Ok, I am doing a php script that divides a number by the colums of rows, and I have to do some number rounding. I wanted to know how I could always make the number round up, never down.

Code:
$number = round(29 / 4);
How could I make that around from 7.25 to 8, and not to 7.
__________________
ATLien is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 03-17-2006, 01:25 AM   #2 (permalink)
v7n Mentor
 
DaveyBoy's Avatar
 
Join Date: 10-13-03
Location: England.
Posts: 6,183
iTrader: 0 / 0%
Latest Blog:
None

DaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest orderDaveyBoy is a web professional of the highest order
http://uk.php.net/manual/en/function.ceil.php

Maybe that command?
DaveyBoy is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-17-2006, 06:55 AM   #3 (permalink)
Contributing Member
 
Join Date: 07-30-05
Posts: 282
iTrader: 0 / 0%
Latest Blog:
None

Radnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really nice
see this.... PHP Round

And how about this:
Code:
$number = round(29 / 4 + .5);
Radnor is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-17-2006, 07:01 AM   #4 (permalink)
Contributing Member
 
Join Date: 07-30-05
Posts: 282
iTrader: 0 / 0%
Latest Blog:
None

Radnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really niceRadnor is just really nice
Code:
<?php echo round(29 / 4); // 7 echo "<br>"; echo round(29 / 4 + .5); // 8 ?>
Radnor is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-17-2006, 07:04 AM   #5 (permalink)
Inactive
 
kyleposey's Avatar
 
Join Date: 03-02-06
Location: Indianapolis, Indiana
Posts: 142
iTrader: 0 / 0%
kyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nicekyleposey is just really nice
The ceil() function will do exactly what you want, round any decimal number to the next highest whole number. round() will round it to the nearest whole number, and floor() will round it to the next lowest whole number.
Code:
3 / 5 = .6 round(3 / 5) = 1 ceil(3 / 5) = 1 floor(3 / 5) = 0 12 / 5 = 2.4 round(12 / 5) = 2 ceil(12 / 5) = 3 floor(12 / 5) = 2
kyleposey is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Im Back! Hi-5 all-round! :D Sheen91 Forum Lobby 4 11-15-2007 05:56 PM
Big Paid Link Round Up peter_d SEO Forum 2 10-10-2007 05:31 AM
ok...round 2 drew68 Web Design Lobby 3 08-10-2006 02:37 AM
IMR goes round the world SVB Graphic Design Forum 77 05-13-2004 03:01 PM
Round slices .... pmech Graphic Design Forum 23 10-16-2003 02:51 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 11:19 AM.
© Copyright 2008 V7 Inc