While the above code won't work, it's close:
$pattern = '@\[b\](.*?)\[/b\]@e';
$replace = 'myFunction("$1")';
preg_replace($pattern, $replace, $text);
What the above code snippet will do is match the text inside the [b][/b] brackets, call myFunction() with that text as the parameter, and then replace the matched text with whatever was returned from the function.
Note that the difference is the 'e' modifier on the end of the regexp pattern. You might also want to add 's' and 'i' which, respectively, allow for line breaks to match the "." and make the pattern case-insensitive.