PHP htmlentities allow <b> and <i> only

html-entities, php, tags

Solution

It's pretty easy

<?php
$string = htmlentities($text);
$string = str_replace(array("&lt;i&gt;", "&lt;b&gt;", "&lt;/i&gt;", "&lt;/b&gt;"), array("<i>", "<b>", "</i>", "</b>"), $string);

Problem

Using `htmlentities()` is there a way I can set to allow only `<b>` and `<i>` to convert into bold and italic text? I know there was one way of doing this, but i have forgotten.

Original source