Functions

Consider using include_once() and require_once() to avoid possible errors caused by one file being included several times. This is particularly important when you define a class in one file, and other programmers try to use it.

It is generally good practice to put commonly used functions into a standard include file, that is used with include_once() at the start of scripts that need it. If you adopt this method and end up having some functions local to each script, you may wish to name them so as to make it clear that they are local so that people do not look for them in the standard include file.

 

Next chapter: Distinguishing code blocks >>

Previous chapter: Variable naming

Jump to:

 

Home: Table of Contents

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar