home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

integer division in PHP

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2628
Discussions: 201,005, Posts: 2,380,074, Members: 246,372
Old March 15th, 2007, 06:04 PM   Digg it!   #1 (permalink)
Mobile Member
 
ShuckyD's Avatar
 
Join Date: Apr 2005
Location: S. Central PA
Posts: 3,602
integer division in PHP

I'm working on a cash tendering program and i cant seem to get it working because i haven't found a way in PHP to do integer division to truncate the decimal. Anyone have an idea how to work with/do integer division in PHP.
__________________
Thinkpad T61 14.1" wide | WinXP Pro | C2D T8300 CPU | 3GB DDR2 | 160GB HDD | AGN & WWAN
Lenovo S10 10.2" LED display | 1.6Ghz Atom CPU | 1GB DDR2 | 1.3mp webcam | B/G WiFi | 160GB HDD
ShuckyD is offline   Reply With Quote
Old March 15th, 2007, 07:13 PM     #2 (permalink)
Super F@D Folder
 
Join Date: Jun 2004
Posts: 5,083
Send a message via AIM to sr71000
haven't been around php long enough to know if this matters but what version of php you working with? have you tried the \ operator instead of / ? how about using a floor/truncate function after division?
sr71000 is offline   Reply With Quote
Old March 15th, 2007, 07:16 PM     #3 (permalink)
Mobile Member
 
ShuckyD's Avatar
 
Join Date: Apr 2005
Location: S. Central PA
Posts: 3,602
tried both... what i ended up doing (ohh php 4.3 btw) was modulus division and then reversing it, with modulus i would get the remainder, then i would subtract that from another, which means i needed a temp var, which was fine, little extra code, but the more i looked around the less i found that PHP could do modulus
ShuckyD is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
3 X 3 Integer array VB redfoxstorm Webmastering and Programming 22 October 26th, 2008 10:04 AM
Which GM Division Should Go? osprey4 IMO Community 57 March 29th, 2005 11:45 PM
more integer spaces korgul Webmastering and Programming 15 July 1st, 2003 02:04 AM
integer performance dmanlyr Processors, Memory, and Overclocking 2 December 1st, 2002 10:20 AM
integer divide by 0 error MDS Applications and Operating Systems 4 May 25th, 2002 05:15 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3134)
‘Rogue’ or ‘Rouge’? (10)
Foxconn Blackops x48 MoBo (5)
Nvidia GTX 260 problem (14)
Delete an OS (18)
Laptop with wireless problem. (14)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
Point and Shoot Camera Suggestions. (9)
windows vista security holes (19)
[F@H SPAM 11/16/09] ! 1/2 months to.. (42)
windows 7 problem (7)
Internet Lost (5)
Recent Discussions
Hp Artist Edition + Matching Bag (1)
cant access the internet (1)
COD radeon problems (0)
Charge4All Black Friday Special - Twi.. (0)
Browsers wont load websites (4)
Unallocated Space (3)
Size after cutting 700Mb file is 2.5 .. (1)
Blackberry Bold 9000 (0)
Can't open Word (13)
Rar volume (number 7) (1)
System restore :) (1)
Laptop with wireless problem. (14)
Looking for new motherboard (2)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (42)
add ram to existing (4)
Computer shutting down on its own (6)
EVGA 9800 gtx help with finding a goo.. (13)
"Documents and Settings" fo.. (7)
Delete an OS (18)
Outputing 1080p from my PC to my 720p.. (0)
panasonic dmr ez48veb recorder (0)
Need help getting speakers to work (2)
Nvidia GTX 260 problem (14)
Point and Shoot Camera Suggestions. (9)
Is the PSU I received dead? (16)


All times are GMT -4. The time now is 05:33 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28