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.

Archived

This topic is now archived and is closed to further replies.

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