PHP require_Once Keyword

PHP return Keyword
PHP require Keyword

In this article, you will learn how to use require_once keyword to include external PHP script file in your code.

The require_once keyword in PHP is used to embed PHP code from another file. If the file is not found, a fatal error is thrown and the program stops. If the file was already included previously, this statement will not include it again.

examples of the REQUIRE_Once function

Example 1. In this example, we use require_once to add a footer to a page.

<!DOCTYPE html>
<html>
<body>

<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php require_once 'footer.php';?>

</body>
</html>
PHP return Keyword
PHP require Keyword

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top