Note that param $unique must be different for multiple tasks if You want to run they all separately. If param $unique is equal for multiple tasks You will get the same task:
<?php
$unique=1;
$gclient = GearmanClient();
$gclient->addServer('srv');
$this->setCreatedCallback(function(GearmanTask $task) {
print $task->jobHandle() . "\n";
});
$gclient->addTask('function_name', 'workload', null, $unique);
$gclient->addTask('function_name', 'workload', null, $unique);
$gclient->addTask('function_name', 'workload', null, $unique);
$gclient->runTasks();
sleep(5);
?>
This sript will print only one handler:
H:srv:377382343
H:srv:377382343
H:srv:377382343