Jump to content

How to merge included arrays of the same variable name?


cheneymac

Recommended Posts

There are multiple php arrays on my network that I would like to merge into a single array, but I am not sure how as they are all assigned to the same variable names.

 

For instance file a.php contains only a multidimensional array:

<?php $mocks = array(array(),array()); ?>

 

Files b.php and c.php contain the exact same php code with different content stored in their arrays.

 

I am including these files' contents into another file: xyz.php.  In xyz.php how do I merge the array contents of a.php, b.php, c.php into a single array even though each of those three files assigns their respective arrays to the $mocks variable?  Unfortunately, each of the included files is owned by a separate person, and so I cannot alter those files, such as changing the variable name to something unique, without crashing applications written by the file owners.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.

×
×
  • 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.