El primero, se podría mejorar así,
:http://www.desarrolloweb.com/articulos/2438.php
El segundo es mio, xD
© 2010, Shell Root Ltda.
Y el tercero de Yoya!
Código (php) [Seleccionar]
function BBcode($texto){
$texto = htmlentities($texto);
$a = array(
"/\[i\](.*?)\[\/i\]/is",
"/\[b\](.*?)\[\/b\]/is",
"/\[u\](.*?)\[\/u\]/is",
"/\[img\](.*?)\[\/img\]/is",
"/\[url=(.*?)\](.*?)\[\/url\]/is"
);
$b = array(
"<i>$1</i>",
"<b>$1</b>",
"<u>$1</u>",
"<img src=\"$1\" />",
"<a href=\"$1\" target=\"_blank\">$2</a>"
);
$texto = preg_replace($a, $b, $texto);
$texto = nl2br($texto);
return $texto;
}
:http://www.desarrolloweb.com/articulos/2438.php
El segundo es mio, xD
© 2010, Shell Root Ltda.
Y el tercero de Yoya!