PHP 7.2.0 Alpha 2 Released


(PECL gearman >= 0.5.0)

GearmanJob::__constructCrée une nouvelle instance GearmanJob


public GearmanJob::__construct ( void )

Crée une nouvelle instance GearmanJob représentant un travail assigné à un agent.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Un objet GearmanJob.

add a note add a note

User Contributed Notes 1 note

liv_romania at yahoo dot com
1 year ago
Usually you will not need to create a GearmanJob object. The GearmanJob instance will be passed to a registered function with the job server when GearmanWorker::addFunction is used:

// create the worker
$worker= new GearmanWorker();

// add the default job server (localhost)
$worker->addServer('', 4730);

// define a variable to hold application data
$count = 0;

// add the reverse function
$worker->addFunction('reverse', 'my_reverse_function', $count);

// start the worker listening for job submissions
while ($worker->work());

my_reverse_function(GearmanJob $job, &$count)

$count . ': ' . strrev($job->workload()) . "\n";
To Top