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 7025121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:55:57+00:00 2026-05-27T23:55:57+00:00

I use following simple code to include all files from common folder. $path=array(); $ds=DIRECTORY_SEPARATOR;

  • 0

I use following simple code to include all files from common folder.

$path=array();
$ds=DIRECTORY_SEPARATOR;
$path['root']=$_SERVER['DOCUMENT_ROOT'];
$path['common']=$path['root'].$ds."common".$ds;

//Include settings
require $path['common'].$ds."settings.php";

//including common php files
foreach (glob($path['common'].$ds."*.php") as $filename) {
    if($filename!="settings.php")
    require $path['common'].$ds.$filename;
}

As you see, at first I use

require $path['common'].$ds."settings.php";

then including all the rest of files with foreach loop.

I wonder, if it is possible to include setting.php file first then all other files inside foreach loop, without writing line above?

  • 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-05-27T23:55:58+00:00Added an answer on May 27, 2026 at 11:55 pm
    $files=glob($path['common'].$ds."*.php";
    array_unshift($files,$path['common'].$ds."settings.php");
    foreach ($files as $filename)
      require_once $filename;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everybody out there i write a very simple c code which is following: #include<stdio.h>
Please consider the following simple use case: public class Foo { public virtual int
for example i use following command to find a record SELECT `users`.`mail` FROM `users`
I use the following to get a list of project files that need to
Consider the following use of template template parameters... #include <iostream> template <typename X> class
I use the following code to create countdowns in Javascript. n is the number
I want to use the PHP Simple HTML DOM Parser to display all my
I have header.php and footer.php files which I include in all of my pages.
I am trying to compile the following very very simple piece of source code:
The following code works fine, a simple template class with a definition and a

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.