Variáveis PHP em funções anônimas
Eu estava brincando com funções anônimas em PHP e percebi que elas não parecem atingir variáveis fora delas. Existe alguma maneira de contornar este problema?
Exemplo:
$variable = "nothing";
functionName(someArgument, function() {
$variable = "something";
});
echo $variable; //output: "nothing"
Isto irá produzir "nada". Existe alguma maneira que a função anônima pode acessar o$variable
?