Workshop

Quiz

1: How would you acquire a Unix timestamp representing the current date and time?
2: Which function accepts a timestamp and returns an associative array representing the given date?
3: Which function would you use to format date information?
4: How would you acquire a timestamp for an arbitrary date?
5: Which function could you use to check the validity of a date?

Answers

A1: The time() function returns the current date in timestamp format.
A2: The getdate() function returns an associative array whose elements contain aspects of the given date.
A3: The date() function is used to format a date.
A4: Given arguments representing the hour, minute, second, month, day of month, and year, the mktime() function returns a Unix timestamp. ...

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.