In terms of best practices, is it advisable to completely discard PHP5 resources when transitioning to PHP8?

When transitioning from PHP5 to PHP8, it is advisable to update and refactor any PHP5 resources to ensure compatibility and take advantage of the new features and improvements in PHP8. While it may be tempting to completely discard PHP5 resources, it is recommended to review and refactor them as needed to ensure a smooth transition and maintain the functionality of your codebase.

// Example of updating PHP5 resource to PHP8
// PHP5 code
$mysqli = new mysqli($host, $user, $password, $database);

// PHP8 code
$mysqli = new mysqli($host, $user, $password, $database);
if ($mysqli->connect_error) {
    die("Connection failed: " . $mysqli->connect_error);
}