Приглашаем посетить
Есенин (esenin-lit.ru)

Chapter 3. Code Organization and Reuse

Previous
Table of Contents
Next

Chapter 3. Code Organization and Reuse

At some point in coding, you will want to reuse some code that you have already written. PHP provides a number of ways to organize and reuse code, which we have grouped into three broad categories. These will be covered over the next two chapters. In this chapter, we will discuss functions, the most straightforward way to reuse code. We will then look at putting code into separate reusable files, which can then be referenced and used from other scripts.

By the end of this chapter, we will see how PHP lets us

  • Create functions we can call to reuse our code

  • Pass parameters to our functions and return values back from them

  • Interact with variables and data in different parts of our scripts

  • Put code and groups of functions in other files and include them within our scripts


Previous
Table of Contents
Next