Chapter 5
Using Functions and Session Variables
In This Chapter
Creating functions to manage your code's complexity
Enhancing your code by using functions
Working with variable scope
Getting familiar with session variables
Incorporating session variables into your code
PHP programs are used to solve interesting problems, which can get quite complex. In this chapter, you explore ways to manage this complexity. You discover how to build functions to encapsulate your code. You also learn how to use session variables to make your programs keep track of their values, even when the program is called many times.
Creating Your Own Functions
It won't take long before your code starts to get complex. Functions are used to manage this complexity. As an example, take a look at Figure 5-1.
Rolling dice the old-fashioned way
Before I show you how to improve ...
Get HTML5 and CSS3 All-in-One For Dummies, 3rd 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.