Files
developer-roadmap/roadmaps/php/content/include_once@SwtLDgyPmDry20qS4FBfH.md
T
Arik Chakma 274082fd77 feat: clean roadmap content and sync scripts (#10181)
* refactor: clean to roadmap content

* refactor: move shared helpers into scripts/lib
2026-07-28 05:45:17 +06:00

708 B

include_once

The include_once statement is a part of PHP's file-handling toolkit, allowing developers to include a PHP file within another PHP file, but only for a one-time execution. This way, you can ensure that functions or objects defined in the included file are not duplicated leading to errors. It helps keep your code DRY (Don't Repeat Yourself) and clean. Here is a small example:

include_once 'database.php';

$db = new Database();

In this simple code snippet, we include the database.php file once, giving us access to the Database class.

Visit the following resources to learn more: