Generating date-based drop-down menu options : split « String « PHP






Generating date-based drop-down menu options

 
<?php
list($hour, $minute, $second, $month, $day, $year) = split(':', date('h:i:s:m:d:Y'));

for ($i = 0; $i < 7; ++$i) {
    $timestamp = mktime($hour, $minute, $second, $month, $day + $i, $year); 
    $date = date("D, F j, Y", $timestamp);
    print "<option value='$timestamp'>$date</option>\n";
}
?>
  
  








Related examples in the same category

1.split() function divides a string into various elements.
2.split.php
3.Use split() to limit a parameter to restrict division of $ip