(PHP 8 >= 8.4.0)
pg_socket_poll — Poll a PostgreSQL connection socket for read/write readiness
Polls a PostgreSQL connection socket for read and/or write readiness. The socket can be obtained using pg_socket(). This function is useful for implementing non-blocking, asynchronous query workflows.
socketread1
to check, 0 to skip.
write1
to check, 0 to skip.
timeout-1 to wait indefinitely, or
0 to not wait at all.
Returns a positive value if the socket is ready, 0
if the timeout was reached, or -1 on error.