What are some common mistakes to avoid when trying to make links clickable in PHP?

One common mistake to avoid when trying to make links clickable in PHP is forgetting to include the "http://" or "https://" protocol in the link. This will result in the link not being clickable. To solve this issue, make sure to include the protocol in the link before displaying it on the page.

$link = "example.com";
if (!preg_match("~^(?:f|ht)tps?://~i", $link)) {
    $link = "http://" . $link;
}
echo '<a href="' . $link . '">Click here</a>';