试图调用preg_replace中的函数

$string = 'Hello [user=1]';

$bbc = array('/\[user=(.*?)\]/is');

$replace = array(user('textlink',$1));
$s = preg_replace($bbc , $replace, $string);
echo $s

How do I change $1 in preg_replace with a function?

If I understand you correctly, you want to execute user() function on each match? As mentioned in comments, use the preg_replace_callback() function.

<?php
$string = 'Hello [user=1]';
$s = preg_replace_callback(
    '/\[user=(.*?)\]/is',
    function($m) {return user('textlink', $m[1]);},
    $string
);
echo $s;

You may use a preg_replace_callback_array:

$string = 'Hello [user=1]';

$bbc = array(
    '/\[user=(.*?)\]/is' => function ($m) {
            return user('textlink',$m[1]);
        });

$s = preg_replace_callback_array($bbc, $string);
echo $s;

See PHP demo.

You may add up the patterns and callbacks to $bbc.