PHP include_once Keyword

PHP instanceof Keyword
PHP include Keyword

In this article, you will learn how to include PHP scripts from external files. The PHP include_once keyword is used to embed PHP script from an external PHP file.

If the file does not exist, it will show a warning however, the program will execute successfully.

If the file is already included, this statement will be ignored.

examples of the INCLUDE_ONCE keyword

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

</body>
</html>
PHP instanceof Keyword
PHP include Keyword
en English
X
Scroll to Top