Tag Archives: convert links to bbcode

How to Convert HTML Link Code into BBCode With PHP

Another short function appears on my blog. If you need to convert your HTML code, containing links only, into BBcode, you need this function: function make_bbcode($normal) { $samurl=str_replace(“<a href=”, “[url=”, $normal); $samurl=str_replace(“</a>”, “[/url]”, $samurl); $samurl=str_replace(“>”, “]”, $samurl); return($samurl); } That’s a very simple solution that doesn’t cover all the instances of HTML code. If you need a good… Read More »