Chapter3.Code Organization and Reuse


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




Core Web Application Development With PHP And MYSQL
Core Web Application Development with PHP and MySQL
ISBN: 0131867164
EAN: 2147483647
Year: 2005
Pages: 255

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net