I'm trying to achieve multitasking in PHP. At the moment I'm evaluating AMPHP framework, and in particular paralell and paralel-functions.
But I can't figure how is to create a method callable...
The idea is that I will have a Class with some methods and I want to instantiate multiples objects, and invoque, for each one, the same method, but in paralell, or asynchronously.
I found a TestCase in parallel-functions folder, and I can't figure out what is doing
public function testClassInstanceMethod() {
$instance = new TestCallables;
$callable = [$instance, 'instanceMethod'];
$result = $callable(1); //<-- what is (1)?
$callable = parallel($callable);
$this->assertSame($result, Promise\wait($callable(1)));
}
What happened if I create multiples instances?
$instances[] = new TestCallables;
I think that what I need to know first is how to create a callable class/method/function... in PHP.
Important information: This should run in web environment ( no pThreads !) in Yii Framework.
Any suggestions? Best Regards