Consolidating Include Statements - Total Newbie Question

I’ve been trying to find a way to consolidate PHP include statements, such as:

<?php include ('form2.php'); ?><?php include ('form2c.php'); ?><?php include ('form3.php'); ?>

I’ve tried a number of possible solutions so far, none of which work, the three PHP books I have don’t discuss it, and I haven’t (yet) been able to find a solution online.

I thought something like:

<?php include ('form2.php, form2c.php, form3.php'); ?>

or:

<?php include ('form2.php', 'form2c.php', 'form3.php'); ?>

or:

<?php include ('form2.php'); 'form2c.php); 'form3.php'); ?>

or:

<?php include ('form2.php'), 'form2c.php), 'form3.php'), ?>

but none work.

include can only include one file at a time.
You could try the following


function include_multi()
{
  foreach(func_get_args() as $arg)
    include($arg);
}
include_multi('form2.php', 'form2c.php', 'form3.php');

I have seen a file of include statements in one file that is then included in another. Put all your standard include statements, which is what I am assuming you want to do, in a file and then include that file in all files you need them.

I have seen this done in C++ so not sure of any consequences, if any, in PHP.

Thanks. I think that’s working.