too long

I have a gearman worker in php. The worker code has a class and a function defined within the class.

I am not able to register and call that function using gearman worker using an object of the class. Below is the code. Please help.

<?php
class Validation {

    public function myfunction() {
        $xyz = 0;
        )
}

$myobj = new Validation();
$worker = new GearmanWorker();
$worker->addServer('localhost');
$worker->addFunction("myobj->myfunction","myobj->myfunction");

while($worker->work())
{

if ($worker->returnCode() != GEARMAN_SUCCESS)
{
syslog(LOG_ERR, "return_code: " . $worker->returnCode());
break;
}
}

?>

From this GearmanWorker's document, you need to input callable into 2nd param:

$myObj = new Validation();
$worker->addFunction("myfunction",array($myObj, "myfunction"));

I didn't test this code since I don't have Gearman installed here, but hope it helps.