Two reasons for that: your created function doesn't return a value, and the first argument to create_function() is supposed to contain the names of the variables the created function uses. What you're creating is equivalent to writing
function anonymous($find[2])
{
"<pre>$a[1]</pre>";
}
Which isn't going to work at all. (Incidentally, since PHP 5.3, you could write the function directly, without using create_function()).
Going back to what you had originally:
$find = array(
...
...
'{[code](\r\n|\r|\n)*(.+)
}'):
$replace = array(
...
...
'<pre>\2</pre>'); [/code]
You want the function called by preg_replace_callback to take the second reference and return the highlighted version. So a function that does something like this:
function code_tag_callback($match)
{
// Strictly speaking, you shouldn't need the <pre>,
// since highlight_string() already returns its results
// wrapped in the more meaningful <code> tags.
return '<pre>' . highlight_string($match[2]) . '</pre>';
}
Now you could use create_function() here, but since it's going to do the same thing every time it's called it's more efficient all round to just create it once as an ordinary function and use it. I called it "code_tag_callback()" up there, so the preg_replace_callback call would be
preg_replace_callback('{[code](\r\n|\r|\n)*(.+)
}', 'code_tag_callback', $whatever)[/code]