[Solved] How can the current time be used as a conditional value in php?


Try this

$time = strtotime("now"); // You will get the current time in UNIX timestamp..


if(($time%2)==0){ 
    header ('Location: http://www.misitio1.com'); 
}else{ 
    header ('Location: http://www.misitio2.com'); 
}

If you want to work on the value of the current hour or minute,

$hr = date("H"); //Change it depending on your wish, 12 hr or 24 hr time. This will return 24 hr time.
$min = date("i");

if((($hr%2)==0) || (($min%2)==0)){ //You can add condition as per your requirment
    header ('Location: http://www.misitio1.com'); 
}else{ 
    header ('Location: http://www.misitio2.com'); 
}

2

solved How can the current time be used as a conditional value in php?