Pee pee comes with many built in functions in addition to these predefined functions.
We can also create our own custom functions a function is a block of statements that can be called upon
whenever they're required a function will not execute unless we specifically call the function in our
script the syntax for a function starts with the word function followed by the function name we can
place the function statements inside the open and close.
Curly braces the function name can start with a letter or an underscore but not a number function names
are not case sensitive
in this example.
We've created a function called DISPLAY TEXT function as one statement.
An echo statement that will display the text.
My first function to call the function.
We simply write the function name followed by parentheses and a semicolon.
As shown here
we can see the final output in our web browser.
The text.
My first function is displayed
our second example shows how we can use functions to pass information through arguments.
An argument is just like a variable.
Arguments need to be specified inside the parentheses after the function name.
We can assign as many arguments as needed but each must be separated by a comma in this example.
We've created a function named my car with one argument.
Car
function has one statement an echo statement that outputs the value of the argument.
Car
the value of the argument is derived.
When we call the function after the function name we pass along a value to the argument here.
We've called the function three times each time with a different value assigned to the variable car.
Volvo BMW and Honda we can see the corresponding OutPut in our web browser each time the function executes
we can easily add a second argument to our function just place a comma after our first argument and
create the second.
We'll call this one color.
Remember that we'll have to modify our equal statement to output the value assigned to color values
come from when the function is called.
So we'll create values for it to assign to our new argument.
We'll save the file and refresh the page and we can see that the second argument values are now displayed.