草庐IT

callerLocals

全部标签

php - 从字符串在调用函数中创建局部变量

我希望能够调用一个函数,该函数将在调用函数中设置一个或多个局部变量。例如:functionsomeFunc(){loadTranslatedStrings($LOCALS,"spanish");echo$hello;//prints"hola";}functionloadTranslatedStrings(&$callerLocals,$lang){if($lang=='spanish')$callerLocals['hello']='hola';elseif($lang=='french')$callerLocals['hello']='bonjour';else$callerLoc