I have downloaded the PHP Pthreads dll file from http://windows.php.net/downloads/pecl/releases/pthreads/ and enabled it in php.ini as below:
extension=pthreadVC2.dll
extension=php_pthreads.dll
I have used below sample code:
<?php
class AsyncOperation extends Thread
{
public function __construct($arg){
$this->arg = $arg;
}
public function run(){
if($this->arg){
printf("Hello %s\n", $this->arg);
}
}
}
$thread = new AsyncOperation("World");
if($thread->start())
$thread->join();
when i executed the code i get the following error:
Fatal error: Class 'Thread' not found in C:\htdocs\threads\AsyncOperation.php on line 2 Call Stack: 0.0008 333464 1. {main}() C:\htdocs\threads\AsyncOperation.php:0