SHARE
TWEET

Untitled

a guest Oct 21st, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $patterns = array(
  2. '#[b]s*(.*?)s*[/b]#s',
  3. '#[u]s*(.*?)s*[/u]#s',
  4. '#[strike]s*(.*?)s*[/strike]#s',
  5. '#[em]s*(.*?)s*[/em]#s',
  6. '#[red]s*(.*?)s*[/red]#s',
  7. '#[green]s*(.*?)s*[/green]#s',
  8. '#[yellow]s*(.*?)s*[/yellow]#s',
  9. );
  10.  
  11. $replacements = array(
  12. '<b>$1</b>',
  13. '<u>$1</u>',
  14. '<strike>$1</strike>',
  15. '<em>$1</em>',
  16. '<red>$1</red>',
  17. '<green>$1</green>',
  18. '<yellow>$1</yellow>',
  19. );
  20.  
  21. $text = preg_replace($patterns, $replacements, $text);
RAW Paste Data
Top