) For example,
assuming that you titled this library taxation.library.php, you could include it into
a script like this:
require_once("taxation.library.php");
...
?>
Once included, any of the three functions found in this library can be invoked
as needed.
Summary
This chapter concentrated on one of the basic building blocks of modern-day programming
languages: reusability through functional programming. You learned how to
create and invoke functions, pass information to and from the function block, nest
functions, and create both recursive and variable functions. Finally, you learned how
to aggregate functions together as libraries and include them into the script as needed.
The next chapter introduces PHP??™s array features, covering the languages??™s vast
swath of array management and manipulation capabilities.
127
?– ?– ?–
C H A P T E R 5
Arrays
Much of your time as a programmer is spent working with data sets. Some examples of
data sets include the names of all employees at a corporation; the U.S. presidents and
their corresponding birth dates; and the years between 1900 and 1975. In fact, working
with data sets is so prevalent that a means for managing these groups within code is
a common feature of all mainstream programming languages. Within the PHP language,
this feature is known as the array, which offers an ideal way to store, manipulate, sort,
and retrieve data sets.
Pages:
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208