PHP code example of brianlmoon / net_gearman
1. Go to this page and download the library: Download brianlmoon/net_gearman library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brianlmoon / net_gearman example snippets
$client = new Net_Gearman_Client("localhost");
$set = new Net_Gearman_Set();
$task = new Net_Gearman_Task("Reverse_String", "foobar");
$task->attachCallback(
function($func, $handle, $result){
print_r($result)
}
);
$set->addTask($task);
$client->runSet($set, $timeout);
class Reverse_String extends Net_Gearman_Job_Common {
public function run($workload) {
$result = strrev($workload);
return $result;
}
}