Chapter 7. Working with Functions


Functions are at the heart of a well-organized script and will make your code easy to read and reuse. No large project would be manageable without them because the problem of repetitive code would bog down the development process. Throughout this chapter, we will investigate functions and demonstrate some of the ways functions can save you from repetitive work. In this chapter, you will learn

  • How to define and call functions from within your scripts

  • How to pass values to functions and receive values in return

  • How to call a function dynamically using a string stored in a variable

  • How to access global variables from within a function

  • How to give a function a "memory"

  • How to pass data to functions by reference

  • How to create anonymous functions

  • How to verify that a function exists before calling it




Sams Teach Yourself PHP, MySQL And Apache All in One
Sams Teach Yourself PHP, MySQL and Apache All in One (3rd Edition)
ISBN: 0672328739
EAN: 2147483647
Year: 2004
Pages: 327

Similar book on Amazon

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