Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

parseubb

This function will parse the BBCodes in the given string $text.
To only parse certain BBCodes use the $selected string to separate those BBCodes you want do be passed with a |.
BBCodes was invented for forums to remove the need of HTML.
BBCodes are fare more secure as you have control over what types of codes your users are allow to insert into your site.
Pure HTML code may be used to harm your site, BBCodes gives you the control.

parseubb

Quote

parseubb ( string $text [, string $selected] )


Parameters
text
The string which contains the text to be parsed

selected
Use this to only parse given BBCodes (separate each bbcode with a | ) , rest will not be touched

Return Values
This function will return the $text parsed with the BBCodes which are inside it

Examples
Code
<?php
// Example 1
echo parseubb("[b]This text is bold[b]");
 
// Example 2
echo parseubb("[i]This text is italic[i]");
 
// Example 3
echo parseubb("[u]This text is underlined[u]");
?>
Here we will parse strings containing BBCodes


Output to Example 1

Quote

<strong>This text is strong</strong>


Output to Example 2

Quote

<i>This text is italic</i>


Output to Example 3

Quote

<u>This text is underlined</u>


Example 4
Code
<?php
$text = "[b][i][u]Some text[/u][i][b]";
echo parseubb ($text, "b|i")
?>

Here we will only parse the b and i BBCodes, leaving the u BBCode untouched

Output to Example 4

Quote

<strong><i>[u ]Some text[/u ]</i></strong>