Oh you don't need that function, you can use preg_replace like so:
PHP Code:
<?php
$text = '[U]Here [I]is[/i] some [b]BB Code[/B][/U]... [ PhP]<?php echo "hello world."; ?>[/ pHp].';
/*Leave out spaces by the {php} BB code, I put them for it to show on RZ..*/
$text = preg_replace('/\[php\](.*)\[\/php\]/Usie','php_box("\\1")',$text);
$text = preg_replace('/\[b\](.*)\[\/b\]/Usi','<strong>\\1</strong>',$text);
$text = preg_replace('/\[I\](.*)\[\/I\]/Usi','<span style="font-style:italic;">\\1</span>',$text);
$text = preg_replace('/\[u\](.*)\[\/u\]/Usi','<span style="text-decoration:underline">\\1</span>',$text);
echo $text;
?>
Also, instead of the function I offered before, just use this one:
PHP Code:
function php_box($text)
{
return '<div style="margin: 5px 20px 20px;">
<div style="margin-bottom: 2px;">PHP:</div>
<div style="padding:4px;border:#000 1px inset">
'.highlight_string($text,true).'
</div>
</div>';
}