php - adding the use of multiple variables to an ob_start function -


i've got following object start code; however, right uses 1 variable ( $online ) .... need add second variable ( $var2 ) code can have "var2"=> $var2 under "online"=> $online. needs added first line of code around use (&$online) code knows use 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 add this? try breaks code completely.

you can add many variables use like, separate them parameters:

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

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -