Below are examples using functions in PHP.

(AKA Part 8 for Assignment 3)

My full name including spaces contains 19 characters.

Milwaukee, Wisconsin

Chicago, Illinois

My explanation:

Functions in PHP allow you to program complex tasks more easily.
There are two types of PHP functions: built-in also known as predefined functions and user-defined functions.

Within PHP there are over a thousand built-in functions. Above you can see an example of one in use called strlen() which counts and returns the number of characters in a string. I did not have to define the function to make it perform this action, it is predefined by php so as long as I know what it is called and what it does I am able to use it effectively. I also referenced the function phpinfo() in the comments as it is also a built-in function we used last week.

User-defined functions are the functions we can customize ourselves. They are a block of statements that can be used repeatedly in a program once defined. The user-defined function I created above has two arguments $city and $state. Within the curly brackets I I told the function to concatenate the two arguments and then echo out the result. After this I called the function twice with different values for the parameters/variables to show that the function echoes whatever values are inputted.