In this lesson our instructor talks about functions. First, he discusses definition of functions, function calls, return values, and function chaining. Then he talks about PHP.net function reference, optional function arguments, and string functions. He also lectures on array, date, and time functions. He ends the lesson with three complete homework challenges.
A function is a group of PHP statements that can be executed on request by
other PHP code using what’s known as a function call .
When reaching a function call, PHP halts execution of the current script,
executes the function’s section of code, and then returns to executing the
A function call is made by typing name of the function followed by a pair of
Function arguments are expressions that can be 'passed' to a function by
placing them in a comma-separated list between the parentheses of a function
Functions are themselves expressions and thus have a value. The value of a
function is called its return value , and this value is 'returned' to the
Functions can be chained together by using the return value of one
function as an argument to another.
php.net provides documentation, via a function reference , for
all of the built-in functions PHP makes available to programmers. The documentation
provides function prototypes , which are descriptions of the arguments a
particular function accepts along with what type of data value it returns.
Functions in PHP can be defined to take optional arguments . In the
php.net function reference, optional arguments are denoted in a
function’s prototype by placing them within pairs of square brackets.
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.