note 95347 added to function.strip-tags

From: Date: Mon, 28 Dec 2009 18:34:15 +0000
Subject: note 95347 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-164397@lists.php.net to get a copy of this message
<?php function strip_bbcode($post) { return preg_replace('/\[(\/){0,1}([^\[]+)\]/', '', $post); } ?> It's a small function to remove all bb tags from a string. Usage: <?php echo strip_bbcode("[quote]Hi, I've got a [b]very big[/b] problem. I can't enter the site [url]http://php.net/[/url].[/quote] Can you enter [i]any other[/i] websites?"); ?> outputs: Hi, I've got a very big problem. I can't enter the site http://php.net/ Can you enter any other websites? ---- Server IP: 194.24.174.37 Probable Submitter: 79.163.138.234 ---- Manual Page -- http://www.php.net/manual/en/function.strip-tags.php Edit -- https://master.php.net/note/edit/95347 Del: integrated -- https://master.php.net/note/delete/95347/integrated Del: useless -- https://master.php.net/note/delete/95347/useless Del: bad code -- https://master.php.net/note/delete/95347/bad+code Del: spam -- https://master.php.net/note/delete/95347/spam Del: non-english -- https://master.php.net/note/delete/95347/non-english Del: in docs -- https://master.php.net/note/delete/95347/in+docs Del: other reasons-- https://master.php.net/note/delete/95347 Reject -- https://master.php.net/note/reject/95347 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164397) next »