Hi! I am modifying a PHP db wrapper for the redis database.
Here's how my function looks:
public function connect() {
$sock = @fsockopen('localhost', '6379', $errno, $errstr, 2);
if ($sock === FALSE) {
return FALSE;
}
else {
stream_set_timeout($sock, 2);
return $sock;
}
}
What I want to do is to call this function from another part in my wrapper:
if ($this->connect() !== FALSE) {
// Do stuff
}
How can I get my connect function to send a FALSE when the fsockopen isn't working?
Thanks!