PHP function for checking for active process ID

This tiny function work on CentOS but I think it will work in all unix based OS.
function is_active_process($pid)
{
	$output = array();
	exec("ps -p ".$pid, $output);
	return (count($output) > 1);	
}