Close Menu
    Facebook X (Twitter) Instagram
    Oixiesoft
    • Home
    • Services
      • WordPress Malware Removal
      • Fix WordPress Errors
      • WordPress Website Development
    • Articles
    • Contact
    Oixiesoft
    Home»Tutorial»PHP»PHP Include Files
    PHP

    PHP Include Files

    Editorial StaffBy Editorial StaffUpdated:May 5, 2022No Comments1 Min Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    You can include the PHP, Html, or content on multiple pages with the help of PHP including files. There are two PHP functions that can be used to include one file into another file.

    PHP include and require Statements

    • Theinclude() Function
    • Therequire() Function

    The include and require statements are applied to include useful codes written in other files.

    These are the most important PHP functions because its reused on multiple pages. This will help designers to make it easy to modify the design of the entire website with less effort.

    If you want to any change in multiple files, you can just change single included file instead of changing thousand of files.

    • require() function will generate a fatal error (E_COMPILE_ERROR) and the script will stop.
    • include() function will only generate a warning (E_WARNING) and the statement will continue.

    Syntax

    include 'filename';
    
    or
    
    require 'filename';

    PHP include Examples

    In this example we will include header file in a page using include statement:

    <html>
    <body>
    
    <h1>Welcome to contact page!</h1>
    <p>here are some text.</p>
    <?php include 'header.php';?>
    
    </body>
    </html>
    
    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Editorial Staff

    Related Posts

    CodeIgniter vs Laravel: A Detailed Side-by-Side Comparison

    Python Arrays

    Python Lambda

    PHP
    • PHP Comments
    • PHP if else Statements
    • The PHP switch Statement
    • PHP Functions
    • PHP for Loop
    • PHP Arrays
    • PHP Include Files
    • PHP Date() and Time() Function
    • PHP Forms Tutorial
    Services
    • Web Development
    • Mobile Application Development
    • WordPress Malware Removal Service
    • Website Design
    • WordPress Development
    • Magento Development
    • Shopify Development
    • SEO Services
    Blog
    • How to Fix the Error Establishing a Database Connection
    • Ping List WordPress
    • How To Fix Japanese Keyword Hack
    • How to remove Malware from WordPress
    Hire Developers
    • Hire WordPress Developer
    • Hire Shopify Developer
    Contact Info
    • Oixiesoft Technologies
      A-40, Block A, I thum Tower, Sector 62, Noida
    • [email protected]
    • Privacy Policy
    • About Us
    • Contact Us
    © 2025 OixieSoft Technologies

    Type above and press Enter to search. Press Esc to cancel.