PHP code example of dasred / bb-code-parser

1. Go to this page and download the library: Download dasred/bb-code-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dasred / bb-code-parser example snippets


$parser = new \DasRed\Parser\BBCode();
echo $parser->parse('[b]10.00[/b] seconds'); //  echos "<strong>10.00</strong> seconds



return [
	'bbcodes' => [
		['regex' => '#\[br\]#i', 'replacement' => '<br />'],
        ['regex' => '#\[b(.*)\](.+)\[/b\]#isU', 'replacement' => '<b>$2</b>'],
    ]
];

$parser = new \DasRed\Parser\BBCode('/var/www/bbcode.config.php');
echo $parser->parse('[b]10.00[/b] seconds'); //  echos "<b>10.00</b> seconds