What are the limitations of storing and reusing socket resources in PHP scripts?

Storing and reusing socket resources in PHP scripts can lead to resource exhaustion and potential memory leaks if not properly managed. It is important to close the socket connection after its use to release the allocated resources. One way to ensure this is by using the `fclose()` function to close the socket resource when it is no longer needed.

// Open a socket connection
$socket = fsockopen('www.example.com', 80);

// Use the socket connection

// Close the socket connection
fclose($socket);