For this PHP code exercise, create a file named date_formatter.php
. This file should contain a function named date_formatter()
which accepts one parameter. This parameter should be a string in year-month-day
format.
If the string is not in this format or not a valid date, date_formatter()
should return an empty string.
If the string is in the correct format, date_formatter()
should return a string with the date in Day, Month nth Year
format. For example, given 2016-01-14
, date_formatter()
would return Thursday, January 14th 2016
.
Review the PHP Code Exercises documentation for more details on performing code exercises.
Jump on the PHP channel in Slack and ask your fellow students and mentors for a hint.