/** * Static method to create your threads from functions ... **/ public static function call($method, $params) { $thread = new Async($method, $params); if ($thread->start()) { return $thread; } /** else throw Nastyness **/ }
public static function call($method, $params = array()) { $thread = new Async($method, $params); if ($thread->start()) { return $thread; } }
<?php class Async extends Thread { public function __construct() { } public function run() { } } $t = new Async(); var_dump($t->start());