The workshop is designed to help you anticipate possible questions, review what you've learned, and begin putting your knowledge into practice.
What conversion specifier would you use with printf() to format an integer as a double? Indicate the full syntax required to convert the integer 33.
How would you pad the conversion you effected in question 1 with zeroes so that the part before the decimal point is four characters long?
How would you specify a precision of two decimal places for the floating-point number we have been formatting in the previous questions?
What function would you use to extract a substring from a string?
How might you remove white space from the beginning of a string?
How would you break up a delimited string into an array of substrings?
Using PHP, how do you acquire a Unix timestamp that represents the current date and time?
Which PHP function accepts a timestamp and returns an associative array that represents the given date?
Which PHP function do you use to format date information?
Which PHP function could you use to check the validity of a date?
The conversion specifier f is used to format an integer as a double:
You can pad the output from printf() with the padding specifierthat is, a space or a zero followed by a number representing the number of characters you want to pad by.
The precision specifier consists of dot (.) followed by a number representing the precision you want to apply. It should be placed before the conversion specifier:
The substr() function extracts and returns a substring.
The ltrim() function removes white space from the start of a string.
The explode() function will split up a string into an array.
The getdate() function returns an associative array whose elements contain aspects of the given date.
You can check a date with the checkdate() function.
Create a feedback form that accepts a user's full name and an email address. Use case conversion functions to capitalize the first letter of each name the user submits and print the result back to the browser. Check that the user's email address contains the @ symbol and print a warning otherwise.
Create an array of doubles and integers. Loop through the array, converting each element to a floating-point number with a precision of 2. Right-align the output within a field of 20 characters.
Create a birthday countdown script. Given form input of month, day, and year, output a message that tells the user how many days, hours, minutes, and seconds until the big day.