10. Creating Functions
In This Chapter
Creating and Using Simple Functions 258
Creating and Calling Functions That Take Arguments 265
Setting Default Argument Values 271
Creating and Using Functions That Return a Value 274
Throughout this book, you’ve used dozens of functions that provide much-needed functionality, such as date()
, setcookie()
, and number_format()
. Whereas those functions have already been defined by PHP, here you’ll be creating your own. However, once created, functions you’ve written and built-in PHP functions are used in the same manner.
Creating functions can save you oodles of time as a programmer. In fact, they constitute a strong step in the process of creating Web ...
Get PHP for the Web: Visual QuickStart Guide, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.