PHP include and require statements
The contents of a PHP file can be inserted into another PHP file (before the server executes it) through include or require statements.
The include and require statements are identical, except for error handling:
require generates a fatal error (E_COMPILE_ERROR) and stops the script
include only generates a warning (E_WARNING), and the script continues
Therefore, if you want to continue execution and output results to the user, even if the include file is missing, use include. Otherwise, in frameworks, CMS, or complex PHP application programming, always use require to reference critical files to the execution flow. This helps improve the security and integrity of the application in the event that a critical file is accidentally lost.
Including files saves a lot of work. This means that you can create standard header, footer or menu files for all pages. Then, when the header needs to be updated, you simply update the header include file.
<?php include("js_news.php"); ?>