Jump to content

Include in for-loop


Phco
 Share

Recommended Posts

Hello,

I have some php-files containing variables with same names but different data.

$arr = array("file1.php", "file2.php", "file3.php");

I want to "get access" to these variables/data. One php-file at a time. This is what i am doing right now:

for($i=0; $i<sizeof($arr); $i++)
    include $arr[$i];

This does work in the first 2 php-files in the array but not on any other of them unless i change start-value of $i. Could you maybe help me solve this?

Edited by cyberRobot
added code tags / removed text background
Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.