Chapter 7. Functions
This chapter examines how you define and use functions. It introduces the general concept of functions before discussing the specifics of how PHP functions work; it covers the following topics:
Defining functions
Understanding variable scope in functions
Managing function parameters
Parameters by value or reference
Parameter default values
Variable-length parameter lists
Using functions to return values
Managing dynamic function calls
Using recursive functions
All programs contain instructions to perform tasks. When sets of tasks are frequently used to perform an activity, they are grouped into units, which are known as functions or methods in most programming languages. PHP calls these units functions.
Functions should perform ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access