-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Visman edited this page Nov 25, 2016
·
2 revisions
$parser = new Parserus();
echo $parser->addBBCode([
'tag' => 'b',
'handler' => function($body) {
return '<b>' . $body . '</b>';
}
])->addBBcode([
'tag' => 'i',
'handler' => function($body) {
return '<i>' . $body . '</i>';
},
])->parse("[i]Hello\n[b]World[/b]![/i]")
->getHTML();
#output: <i>Hello<br><b>World</b>!</i>
$parser = new Parserus(ENT_XHTML);
echo $parser->addBBCode([
'tag' => 'b',
'handler' => function($body) {
return '<b>' . $body . '</b>';
}
])->addBBcode([
'tag' => 'i',
'handler' => function($body) {
return '<i>' . $body . '</i>';
},
])->parse("[i]Hello\n[b]World[/b]![/i]")
->getHTML();
#output: <i>Hello<br /><b>World</b>!</i>
$parser = new Parserus();
echo $parser->addBBCode([
'tag' => 'b',
'handler' => function($body) {
return '<b>' . $body . '</b>';
}
])->addBBcode([
'tag' => 'i',
'handler' => function($body) {
return '<i>' . $body . '</i>';
},
])->parse("[i]\nHello\n[b]\nWorld!")
->getHTML();
#output: <i>Hello<br><b>World!</b></i>