PHP require Keyword

PHP require_Once Keyword
PHP public Keyword

In this article, you will learn how to embed PHP code from another file using require keyword. The require 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.

examples of the REQUIRE keyword

Example 1. In this example, we use require 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 'footer.php';?>

</body>
</html>
PHP require_Once Keyword
PHP public Keyword

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top