PHP – require statement

The require statement in PHP is used to include any external file in our program.

require statement in PHP

we can understand the require statement using the following example:

As require is not a PHP function, so we don’t need to use parenthesis (). So we can also use the require statement in the following way:

The require statement is PHP is mainly used if it is compulsory to use any external file and if we use the require statement to include that file then it will ensure that the file should be included in the program otherwise the program will generate a fatal error and execution will stop immediately.

Leave a Reply

Your email address will not be published.