I have file:
en.php
<?php
$lang['word'] = 'word';
$lang['text'] = 'text';
index.php
<?php
function load($file) {
include $file . '.php';
echo $lang['word'];
echo $lang['text'];
}
load('en');
Question:
How to get array values from en.php and return them as array with load().
How to process file to return each array value in load() to use it in index.php like this:
echo $lang['word'];
I know that include function view file in global scope but variables are in local scope. There for I am looking in "return as array" solution.
Edit:
I want to separate languagse in files en.php, de.php, ru.php ... and then load them into index.php with load. Then retrieve them and echo as $lang['text'].