I am trying simple redis pipelining command using laravel and have an issue :
$a = array("1","2","3");
Redis::pipeline(function($pipe)
{
for ($i = 0; $i < count($a); $i++)
{
$pipe->set("key:$a", $a);
}
});
And I got 'Undefined variable: a '. I think I am missing something here. Anybody can help?
This way you can make a variable to be visible within an anonymous function's scope: