Jump to content

Math help


jmr3460

Recommended Posts

I am trying to use an if (){}else{} with time().

$clean = $month."-".$day."-2010";
$time = time($clean);
$number = 1284706800;
if($timeĀ  <= $number){
$registration_money = 30;
}
else
{
$registration_money = 25;
}

The hope is if the $time which is defined by a date selector is less than 1284706800 (which is the time for a specific date at midnight) then the value of $registration = 30 else it will be = 25.

Link to comment
https://forums.phpfreaks.com/topic/195898-math-help/
Share on other sites

Thanks for trying. I was not sure what you were saying hooked to. I used strtotime() and did a little different math.

$timed = strtotime($clean);
$cutoff = strtotime("17 September, 2010");
$diff = ($timed - $cutoff);
if($diff > 0){
$registration_money = 30;
}
else
{
$registration_money = 25;
}

Thanks again

Link to comment
https://forums.phpfreaks.com/topic/195898-math-help/#findComment-1029013
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.