Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * This code:
- * - makes bold each part of text surrounded by ** (double star)
- * - makes italic each part of text surrounded by // (double slash)
- * - makes underline each part of text surrounded by __ (double underscore)
- */
- $formatted = preg_replace( array( '#\*\*(.*)\*\*#sU',
- '#//(.*)//#sU',
- '#__(.*)__#sU'),
- array( '<span style="font-weight:bold">$1</span>',
- '<span style="font-style:italic">$1</span>',
- '<span style="text-decoration:underline">$1</span>'),
- $txt);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement