Evil|Clan HOME EVIL|ARCHIVE Evil|Clan
HOME EVIL|ARCHIVE PASTEBIN PRIVACY CONTACT

Pastebin

show all

PaniC posted at 2018-03-19 03:59:33 | hide line numbers

bbcode PHP function

  1. <?php
  2. function BBCode ($string) {
  3.     $search = array(
  4.         '\[b\](.*?)\[\/b\]\',
  5.        '\[i\](.*?)\[\/i\]\',
  6.        '\[u\](.*?)\[\/u\]\',
  7.        '\[img\](.*?)\[\/img\]\',
  8.        '\[url\=(.*?)\](.*?)\[\/url\]\',
  9.        '\[code\](.*?)\[\/code\]\'
  10.    );
  11.    $replace = array(
  12.        '<b>\\1</b>',
  13.        '<i>\\1</i>',
  14.        '<u>\\1</u>',
  15.        '<img src="\\1">',
  16.        '<a href="\\1">\\2</a>',
  17.        '<code>\\1</code>'
  18.    );
  19.    return preg_replace($search, $replace, $string);
  20. }
  21. ?>
  22.  
  23. by http://www.pixel2life.com/forums/index.php?/topic/10659-php-bbcode-parser/