You can split different parts of your PHP code and then use include[_once] or require[_once]:
<?php
...
include "splitfile.php";
include "splitfile2.php";
Or
...
require "splitfile.php";
require "splitfile2.php";
The main difference between include and require is that require will stop executing when it encounters an error by throwing a fatal error while include doesn’t.
Lastly, the difference between the _once
version is that if you already included or required that file before, it won’t include it again which will prevent some errors.
include "config.php";
...
include_once "config.php"; // This won't do anything
https://www.php.net/manual/en/function.require-once.php
https://www.php.net/manual/en/function.include-once.php