Here\'s my problem:
I have a textarea where the user can enter whatever he wants.
When he sends this text (POST method), on the server side I don\'t filter it
Just add a preg_replace() function to revert the escaped a tags after your htmlentities() function
$output = textForWeb($output);
$output = preg_replace('#<a href="(?=https:\/\/|http:\/\/)(.*?)">(.*?)</a>#i', '$2', $output);
echo $output;
That way you can still escape all other HTML in a safe way (instead of using strip_tags() function.)
This preg_replace() function searches for a tags linking to pages starting with http:// or https:// and then replaces the escaped special characters with <, > and ", making the link clickable again.