• Functions provide the core of PHP's programming functionality, and there are hundreds to choose from.

  • However, the chances are you are only going to use about twenty or so in common practice, so don't waste time trying to learn them all - that' what the manual is there for!

  • Writing your own functions eliminates code duplication, thereby reducing the likelihood of bugs, and making it easier for you to make changes to the code.

  • Passing by and returning by reference can often make your script more efficient, however it is important to note that objects are inherently passed by reference.

  • PHP's string manipulation functions are very powerful and very flexible, although it is worth your while always trying to use the least complicated function suitable for your purpose - don't bother with regexps when a simpler function will do.

  • Recursive functions are useful for a wide variety of tasks, whether it be printing a threaded messageboard index or path-finding in a game.


Next chapter: Exercises >>

Previous chapter: Undocumented functions

Jump to:


Home: Table of Contents

Follow us on or Twitter

Username:   Password:
Create Account | About TuxRadar