The client side VB code is handled by Javascript.
As for the server side, a simple [man]str_replace/man can handle it:
$text=str_replace("[b]", "<b>", $text);
// and so on ... lots of options, eh?
while [man]nl2br[/man] can handle the line breaks...
The trickiest thing would be automagically parsing URL's and email addy's....