Php Include File

PHP allows you to include file so that a page content can be reused many times. There are two ways to include file in PHP. if you want the execution to go on and show users the output, even if the include file is missing, use the include statement

  • Include
  • Require
  • Include

    Including files saves a lot of work. This means that you can create a standard header, footer, or menu file for all your web pages. Then, when the header needs to be updated, you can only update the header include file.

    Example :-

    Result

    Welcome to my home page!


    Some text.


    Some more text.


    Copyright © 2017-2018 dwtutorials.com

    Php require

    therwise, in case of FrameWork, CMS, or a complex PHP application coding, always use the require statement to include a key file to the flow of execution. This will help avoid compromising your application's security and integrity, just in-case one key file is accidentally missing.

    Example :-

    Result

    Welcome to my home page!