Closes a Socket instance

- « socket_clear_error

- socket_cmsg_space »

- PHP Manual
- Socket Functions
- Closes a Socket instance

# socket_close

(PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8)

socket_close — Closes a Socket instance

### Description

socket_close(Socket `$socket`): void

socket_close() closes the Socket instance given by `socket`.

### Parameters

`socket`

  A Socket instance created with socket_create() or socket_accept().

### Return Values

No value is returned.

### Changelog

Version | Description
--- | ---
8.0.0 | `socket` is a Socket instance now; previously, it was a resource.

### See Also

- socket_bind() - Binds a name to a socket
- socket_listen() - Listens for a connection on a socket
- socket_create() - Create a socket (endpoint for communication)
- socket_strerror() - Return a string describing a socket error