Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8426789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:37:25+00:00 2026-06-10T04:37:25+00:00

How does include(‘./code.php’); work? I understand it is the equivalent of having the code

  • 0

How does include('./code.php'); work? I understand it is the equivalent of having the code “pasted” directly where the include occurs, but, for example:

If I have two pages, page1.php and page2.php, of which I would need to manipulate different variables and functions in ./code.php, does include() create a copy of ./code.php, or does it essentially link back to the actual page ./code.php?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:37:26+00:00Added an answer on June 10, 2026 at 4:37 am

    See the manual.

    If you include a text file, it will show as text in the document.

    include does not behave like copy-paste:

    test.php

    <?php
    echo '**';
    $test = 'test';
    include 'test.txt';
    echo '**';
    ?>
    

    test.txt

    echo $test;
    

    The example above will output:

    **echo $test;**
    

    If you are going to include PHP files, you still need to have the PHP tags <?php and ?>.

    Also, normally parentheses are not put after include, like this:

    include 'test.php';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like this to work, but it does not: #include <stdio.h> typedef struct
I have this code which does the trick: #include <stdio.h> int main() { int
Why does the following not work: #include <iostream> #include <fstream> #include <stack> std::stack<std::ifstream> s;
Why does the following code crash the compiler? #include <iostream> #include <string> #include <map>
from here Im having trouble understanding they say that ado.net does not include a
So I have tried GetType() but for some reason, It does include the namespace...
The PHP log format does not include the date, for Warnings. For instance PHP
I have a website in php that does include() to embed the content into
Ajax - Asynchronous JavaScript And XML What does it include? HTML, JavaScript, XML, jQuery?
HTML5's localStorage WebStorage has a maximum size of 5MB. Does this include the key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.