I want to be able to call a function that will set one or more local variables in the calling function. For instance:
function someFunc () {
loadTranslatedStrings($LOCALS, "spanish");
echo $hello;
}
function loadTranslatedStrings (&$callerLocals, $lang) {
if ($lang == 'spanish')
$callerLocals['hello'] = 'hola';
else if ($lang == 'french')
$callerLocals['hello'] = 'bonjour';
else
$callerLocals['hello'] = 'hello';
}
(I suppose this cannot be done, but may also ask ...)
source
share