Skip to content

Commit b9dece2

Browse files
Update PING documentation
Related to phpredis#1619
1 parent a98a3fb commit b9dece2

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

README.markdown

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,17 +356,26 @@ $redis->getOption(Redis::OPT_SERIALIZER);
356356

357357
### ping
358358
-----
359-
_**Description**_: Check the current connection status
359+
_**Description**_: Check the current connection status.
360360

361-
##### *Parameters*
362-
363-
(none)
361+
##### *Prototype*
362+
~~~php
363+
$redis->ping([string $message]);
364+
~~~
364365

365366
##### *Return value*
367+
*Mixed*: This method returns `TRUE` on success, or the passed string if called with an argument.
366368

367-
*BOOL*: `TRUE` in case of success. Throws a [RedisException](#class-redisexception) object on connectivity error, as described above.
369+
##### *Example*
370+
~~~php
371+
/* When called without an argument, PING returns `TRUE` */
372+
$redis->ping();
373+
374+
/* If passed an argument, that argument is returned. Here 'hello' will be returned */
375+
$redis->ping('hello');
376+
~~~
368377

369-
Staring from version 5.0.0, the command returns boolean `TRUE` instead of *STRING* `+PONG` as in previous versions.
378+
*Note*: Prior to PhpRedis 5.0.0 this command simply returned the string `+PONG`.
370379

371380
### echo
372381
-----

0 commit comments

Comments
 (0)