Pastebin
show all
PaniC posted at 2018-03-19 03:59:33 | hide line numbers
bbcode PHP function
<?php
function BBCode ($string) {
'\[b\](.*?)\[\/b\]\',
'\[i\](.*?)\[\/i\]\',
'\[u\](.*?)\[\/u\]\',
'\[img\](.*?)\[\/img\]\',
'\[url\=(.*?)\](.*?)\[\/url\]\',
'\[code\](.*?)\[\/code\]\'
);
$replace = array(
'<b>\\1</b>',
'<i>\\1</i>',
'<u>\\1</u>',
'<img src="\\1">',
'<a href="\\1">\\2</a>',
'<code>\\1</code>'
);
return preg_replace($search, $replace, $string);
}
?>
by http://www.pixel2life.com/forums/index.php?/topic/10659-php-bbcode-parser/