1. ## Math Equation

I am trying to setup a small script to increase the cost of a service up to the date of Feb 28th. At this date the original price will be reached. I would like to start out at around 10.50 and go up to 14.99 (original price) dynamically. I.e the price tomorrow will be higher than the price is today. I am not the greatest at formulating equations, but I have done a little bit to find out how many days until Feb 28th. Could anyone help me with the math?

Thanks!!
PHP Code:
``` <? \$sale_end = mktime(0, 0, 0, 2, 28, 07); \$now = mktime(); \$diff = \$sale_end - \$now; \$num_days = round(\$diff / 86400); ?> ```

2. There is a lot of unnecessary code in here. It would be easier to specify that there are 70 days left, and figure it out from there, but this is using what you started with.

PHP Code:
``` <?PHP \$then = mktime(0, 0, 0, 2, 28, 07); //final day\$start = time(0, 0, 0, 12, 19, 06); //start day\$now = time(); //current day//find total days\$timeDiff = \$then - \$start;//find remaining days\$daysRemaining = \$then - \$now;\$days = floor(\$timeDiff/60/60/24);//70 days today - Might as well make this a pre-defined variable since nothing is going to change\$daysLeft = floor(\$daysRemaining/60/60/24);\$originalPrice = 10.50;\$finalPrice = 14.99;//calculate how much the price has to go up\$priceDiff = \$finalPrice - \$originalPrice;//calculate the increase per day\$priceInc = \$priceDiff/\$days;//find how many days have gone by, multiple by the price increment and add to the original\$finalPrice = round(((\$days - \$daysLeft) * \$priceInc) + \$originalPrice,2);echo \$finalPrice;?> ```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•