PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

AMQPConnection::isConnected

(PECL amqp >= Unknown)

AMQPConnection::isConnectedDetermine if the AMQPConnection object is connected to the broker.

Description

public bool AMQPConnection::isConnected ( void )

This method will check whether the connection to the AMQP broker is still valid. It does so by checking the return status of the last command.

Parameters

This function has no parameters.

Return Values

Returns true if connected, false otherwise

Examples

Example #1 AMQPConnection::isConnected example

<?php

/* Create a new connection */
$conn = new AMQPConnection();
$conn->connect();

/* Check that connection is working */
if ($conn->isConnected()) {
    echo 
"Connected to the broker \o/";
}
else {
    echo 
"Cannot connect to the broker";
}

?>

PHP Manual