PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
$d=date(" d ");
do
{
$d++;
echo $d . "<br>";
}
while ($d<15);
?>
That is what i came up with, with the very little i know about php, but i cant get it to work it just gives todays day. And php.net hasn't help me at all with the manual, and nothing else. So i figured to just ask a person.
<?php
function futureday($num_days_future)
{
for ($x=0; $x<$num_days_future; $x++)// loop through and add one day in seconds each time...
{
$numsec = 86400 * $x; //Multiply seconds by num_days_future
$nextday = time()+ $numsec; //Get Unix Time stamp
echo date("j of F Y, h:m a", $nextday)."<br>";
}
}
futureday(15);
?>
9 of November 2004, 11:11 pm
10 of November 2004, 11:11 pm
11 of November 2004, 11:11 pm
12 of November 2004, 11:11 pm
13 of November 2004, 11:11 pm
14 of November 2004, 11:11 pm
15 of November 2004, 11:11 pm
16 of November 2004, 11:11 pm
17 of November 2004, 11:11 pm
18 of November 2004, 11:11 pm
19 of November 2004, 11:11 pm
20 of November 2004, 11:11 pm
21 of November 2004, 11:11 pm
22 of November 2004, 11:11 pm
23 of November 2004, 11:11 pm
I should probably ask about what you did for that script, that way i can learn from it. I see what you did for most of it. But why did you have to this ?
There are 86400 seconds per day. Time() returns the number of seconds since the Unix Epoch. So by adding 86400*$x or the number of days into the future you get that day's date by formating that number of seconds with the date() function.