What PHP code snippet can be implemented to ensure that URLs in the guestbook entries have the correct format?

To ensure that URLs in the guestbook entries have the correct format, we can use PHP's `filter_var` function with the `FILTER_VALIDATE_URL` filter. This function will validate the URL format and return false if it is not a valid URL.

// Validate URL format in guestbook entry
$url = "http://example.com"; // Example URL
if (filter_var($url, FILTER_VALIDATE_URL)) {
    // URL is valid
    echo "URL is valid";
} else {
    // URL is not valid
    echo "URL is not valid";
}