Search the Community
Showing results for tags 'add'.
Found 3 results
Say I have 5 users. Each user will receive their payment based on their individual percentage. For eg. User 1: 5% User 2: 10% User 3: 15% User 4: 15% User 5: 5% Now say I have a total of $100. I want to divide the $100 among the 5 users. But the users with higher % will receive a higher amount than the the ones with lower %. How would I calculate this?
// find the time difference between now and the expiry date $expiry_date = '2017-04-20 09:02:23'; $then = new DateTime($expiry_date); $now = new DateTime(); $remaining_time = $then->diff($now); // I want to add two weeks to the new date. $two_weeks = $now->add(new DateInterval('P2W'))->format('Y-m-d H:i:s'); // new date that combines the remaining time from above and adds 2 weeks to create a new date. This is the issue here. How do I combine these two dates properly? The new date has to be in this format ('Y-m-d H:i:s') $new_date = $remaining_time + $two_weeks;
Hi, I am trying to add values together in my while loop, so far I have: $q->query($DB, $SQL); while($avrating=$q->getrow()): $averageratings = $avrating['sum(rating)'] / $noofreviews; $overallaverage = round($averageratings, 2) + round($averageratings, 2); echo '<p>'.$avrating['rating_name'].': '.round($averageratings, 2).'</p>'; endwhile; echo 'x'.$overallaverage; $overallaverage += $overallaverage / 10; echo 'The Average: '.$overallaverage; from this, I get: x7.34The Average: 8.074 the total shold be: 42.34 then dived by 10 should be 4.23