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’

The above code will include the file every time it is called.

Using ‘include_once’

The above code will include the file only once (if the same script tries to include the script twice then it will be ignored).

Using ‘require’

The above code will include the file but if the file is not available PHP will trow and error.

Comments

Visitor stats.