public function isRunning($pid)
    {
        $lastLine = exec(sprintf('tasklist /fi "PID eq %d" /nh /fo csv 2>nul:', $pid));
        $record = str_getcsv($lastLine);
        return isset($record[1]) && intval($record[1]) === $pid;
    }
public function isRunning($pid)
    {
        $lastLine = exec(sprintf('tasklist /fi "PID eq %d" /nh /fo csv 2>nul:', $pid));
        $record = str_getcsv($lastLine);
        return isset($record[1]) && intval($record[1]) === $pid;
    }
public function isRunning ( $ pid ) { $ lastLine = exec ( sprintf ( 'tasklist /fi "PID eq %d" /nh /fo csv 2>nul:' , $ pid ) ) ; $ record = str_getcsv ( $ lastLine ) ; return isset ( $ record [ 1 ] ) && intval ( $ record [ 1 ] ) === $ pid ; }
Check if the process is running using the "tasklist" command.

@param type $pid
@return bool
Check if the process is running using the tasklist command .