include, include_once & require in PHP 5

Introduction

There are a number of built in functions that can be used to load external files into PHP scripts. Each of the functions may seem to perform the same function but there are key differences:

Using 'include' - will include the file every time it's called:

Using 'include_once' - will include the file only once (if the same script tries to include the script twice then it will be ignored):

Using 'require' - will include the file but if the file is not available PHP will throw an error: