["pipe","r"], 1 => ["pipe", "w"], 2 => ["pipe", "w"]], $fp); // write password fwrite($fp[0],$password . "\n"); fwrite($fp[0],$password . "\n"); // retrieve hash $s = fread($fp[1],512); // and only return the parts before the first line end $lines = preg_split("/\r\n|\n|\r/", $s); return $lines[0]; } }