I am building a system where I want to do it multiple languages ... Well I created the project, inside it has a folder strings (where inside has a file called PT-BR.php), has a file functions (where it has a function that passes the filename and it includes with the include_once), in the file that I'm doing the test by including and calling the function it all normal, but when I echo an var that is inside the file, the error. How can I solve ? or is there an easier method? Thanks
test.php file
<?php
include_once ("class/funcoes.php");
autoLoad();
session_start();
$sl = $_SESSION['lang']; //Passa PT-BR
defineLanguage($sl);
echo $strNome;
file class / funcoes.php
<?php
function defineLanguage ($language) {
$dir = "strings/";
if($language == "PT-BR") {
$include = $dir . "PT-BR" . ".php";
//include_once($include);
include('strings/PT-BR.php');
}
}
file strings / PT-BR.php
<?php
$strNome = "teste";
ERROR
Notice: Undefined variable: strName in /Applications/XAMPP/xamppfiles/htdocs/log-u/testeSession.php on line 11