19.10.3 FunctionsThis is NOT the latest copy of this book; click here for the latest version.
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.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|