printing - Trying to print out the day of an event using php -
im working through joy of php book, alan forbes.
as im new php, have got stuck on pretty first question.
the following program meant print out date of event, yet not.
can shed light on why not working?
<!doctype html> <html> <head> <title>php test</title> </head> <body> <?php $target = mktime(0,0,0,30,2012); $today = time(); $difference = ($target-$today); $days=(int) ($difference/86400); print "our event occur $days days"; ?> </body> </html>
i believe there 1 0 little.
the mktime() has 7 inputs. use 5, meaning 30 month , 2012 day.
should probably:
$target = mktime(0,0,0,8,30,2017); $today = time(); $difference = ($target-$today); $days=(int) ($difference/86400); print "our event occur $days days";
here replaced year more "now". , output 14 days. , today it's 14 days til 2017-08-30.
https://3v4l.org/cl3yo
Comments
Post a Comment