This chapter discusses the
static keyword as it is applied to variables, classes, and methods. You will learn about the scope resolution operator (
::) and its implication in object-oriented design. Finally, I will touch on the often heated debate about the usage of static classes in application design.
To get the most from this chapter, you should already be familiar with variable scope; that is, you should understand global, function, and class scope, and the use of the
$this variable within classes.
A static variable is a variable that exists only in function scope, but that does not lose its value when the function is finished executing; that is, it remembers its value the next ...