Include arrays with the same name from different files in PHP? -


this question has answer here:

i trying figure out how can include arrays have same name php file 2 different files .

i know it's simple, can't seem find right search me solution.

i've been trying reference arrays such function_call(menu_config.$config) isn't working.

assuming both files have $config array. if want 1 resulting array:

include('file1.php'); $new = $config;  include('file2.php'); $new = array_merge($new, $config); 

or 2 new arrays:

include('file1.php'); $config_1 = $config;  include('file2.php'); $config_2 = $config; 

another option function:

function get_config($file) {     include($file);     return $config; }  $config_1 = get_config('file1.php'); 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -