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

  • Home
  • SEARCH
  • 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 8101995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:07:22+00:00 2026-06-05T23:07:22+00:00

I have two files 1 – index.php 2 – main.php index.php call to main.php

  • 0

I have two files

1 – index.php
2 – main.php

index.php call to main.php by <?php require_once("../../includes/main.php"); ?>

How do I know from main.php when it executes,

if index.php calls to him or the same user executes it Standalone?
What should I ask inside main php to continue running the program if was require_once?

  • 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-05T23:07:23+00:00Added an answer on June 5, 2026 at 11:07 pm

    Another approach is to use get_included_files() – the “main” file that included the other ones will always show up on top = be the 0th element of the returned array:

    if (get_included_files()[0] !== __FILE__) {
        // ..included
    } else {
        // ..not included
    }
    

    This will work in most cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I have two files: index.php /lib/user.php Index contains the form: <div class=<? echo $msgclass;
I have two files independant on each other. Let's just call it Class1 and
I have two files: logic.scala and main.scala logic.scala contains one class and main.scala have
I have two files: Test.java Other.java I wanted to learn how to call the
I have two files from a C program. I guess both belong to quite
I have two files checked into GitHub: index.html backup.html Now I want to rename
I have two files like below SomeClass.php class SomeClass { public function display() {
I have two files: // event_test_delete.cpp #include <event.h> int main() { event_base* ev; ev
I have two files in my src/main/resources and I want one file's body to

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.