cohan1279 Posted November 17, 2006 Share Posted November 17, 2006 Hi , I feel kinda dumb for asking this, but im lost. I just need to get the remaider for div. example -- $divamount = floor($amount / 12); --- if $amount = 16 , is there a function i can use to get the remaining 4? $remamount = ? ($amount / 12); ???Ive looked thruogh a list of php functions over and over but havent seen anything. What im tring to do is split up a givin # in to 12 database table rows but i want to be able to put the remainder in the 12th one as well. [code]if ($type == 't_armtrp') { $divamount = floor($amount / 12); if ($amount > 12) { $users[$type] += $amount; $users[armtrain1] += $divamount; $users[armtrain2] += $divamount; $users[armtrain3] += $divamount; $users[armtrain4] += $divamount; $users[armtrain5] += $divamount; $users[armtrain6] += $divamount; $users[armtrain7] += $divamount; $users[armtrain8] += $divamount; $users[armtrain9] += $divamount; $users[armtrain10] += $divamount; $users[armtrain11] += $divamount; $users[armtrain12] += ($divamount + $remamount); $canbuy[$type] -= $amount; print commas($amount)." $uera[$type] have been sent to training for $".commas($cost).".<br>\n"; }[/code]please help........ Link to comment https://forums.phpfreaks.com/topic/27579-should-be-a-simple-answer/ Share on other sites More sharing options...
esukf Posted November 17, 2006 Share Posted November 17, 2006 http://uk.php.net/manual/en/language.operators.arithmetic.phpmodulus % Link to comment https://forums.phpfreaks.com/topic/27579-should-be-a-simple-answer/#findComment-126131 Share on other sites More sharing options...
cohan1279 Posted November 17, 2006 Author Share Posted November 17, 2006 $remamount = ($amount % 12);thanks, im a tard lol Link to comment https://forums.phpfreaks.com/topic/27579-should-be-a-simple-answer/#findComment-126133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.