3-1 PHP Functions

Timestamp Functions

Create a function that will accept a Unix Timestamp as a parameter and format it into mm/dd/yyyy format.

Our current timestamp is 1752239908.
Our current date is 07/11/2025.

Create a function that will accept a Unix Timestamp as a parameter and format it into dd/mm/yyyy format to use when working with international dates.

The current timestamp of France is 1752239908.
The formatted timestamp of France is 07/11/2025 15:18:28.
Local Date and Time: 07/11/2025 08:18:28

String Functions

String to test is " I am a student at DMACC. " with 2 leading and 3 trailing spaces

Number of characters in the string: 27
Number after trimming any leading or trailing whitespace: 24
This is the string converted to lower case: i am a student at dmacc.
The word 'DMACC' is contained in the string.

String to test is " He is a student at Iowa State. " with 3 leading and 1 trailing space.

Number of characters in the string: 34
Number after trimming any leading or trailing whitespace: 30
This is the string converted to lower case: he is a student at iowa state.
The word 'DMACC' is not contained in the string.

Create a function that will accept a number parameter and display it as a formatted phone number. Use 1234567890 for your testing.

(123) 456-7890

Create a function that will accept a number parameter and display it as US currency with a dollar sign. Use 123456 for your testing.

$123,456.00