To make your code more readable, you can place your functions
in a separate file. Many PHP add-ons that you download off the Internet contain
functions already placed into files that you simply include in your PHP program. However, PHP provides four
functions that enable you to insert code from other files.
-
include
-
require
-
include_once
-
require_once
All the include and require functions can
take a local file or URL as input, but they cannot import a remote file.
require and include functions are pretty similar in their
functionality except for the way in which they handle an irretrievable resource.
For example, include and include_once provide a warning if the
resource cannot be retrieved and try to continue execution of the program. The
require and require_once functions provide stop processing of
the particular page if they can't retrieve the resource. Now we're going to get
more specific about these four functions.