Parse HTML user input
问题 Let's say I have a string from the user ( $input ). I can go and strip tags, to allow only allowed tags in. I can convert to text with htmlspecialchars() . I can even replace all tags I don't want with text. function html($input) { $input = '<bl>'.htmlspecialchars($input).'</bl>'; // bl is a custom tag that I style (stands for block) global $open; $open = []; //Array of open tags for ($i = 0; $i < strlen($input); $i++) { if (!in_array('code', $open) && !in_array('codebl', $open)) { //If we