Pass an array from one file to another using include

Posted by mrakodol on Stack Overflow See other posts from Stack Overflow or by mrakodol
Published on 2012-11-28T22:07:02Z Indexed on 2012/11/28 23:04 UTC
Read the original article Hit count: 212

Filed under:
|

How to pass an array from one file to another using include using PHP language? I have one file with some language array(language/langen.php):

global $lang;
$lang['Here'] = 'Here';
$lang['Date'] = "Date";

In other file I have:

include base_url().'language/lang'.$_COOKIE['lang'].'.php';
var_dump($lang);

*(My mistake by coping code - true is var_dump($lang))* But it shows me an error:

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: lang

How to solve this problem and what did I do wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about include