将多个变量的使用添加到ob_start函数中

I've got the following object start code; however, right now it only uses 1 variable ( $online ) .... I need to add a second variable ( $var2 ) to the code so that I can have "var2"=> $var2 under "online"=> $online. This needs to be added to the first line of code around where use (&$online) so the code knows the use this variable.

ob_start(function($c) use (&$online){
    $replacements = array(
        "online"=> $online
    );
    return preg_replace_callback("/{(\w+)}/",function($m) use ($replacements) {
        return isset($replacements[$m[1]]) ? $replacements[$m[1]] : $m[0];
    },$c);
});

How do I add this? Everything I try breaks the code completely.

You can add as many variables to a use as you like, just separate them as you would parameters:

function($c) use (&$online,&$var2)

Following the php documentation on closures, you should use commas. Following the php documentation on arrays, you should also use commas there. Next time try looking it up. The php manual has lots of resources on this subject.

ob_start( function($c) use (&$online, &$var2){
  $replacements = array(
    "online"=> $online,
    "var2" => $var2,
 );
// ...