查找并删除字符串中的特定函数调用。 下面是我在php变量中的字符串

I am having the javascript code below as a string variable, and I would need sub string of the said string which should not contain addInviewFunction, addOutviewFunction function calls.

The Remaining string should be available in another variable.

Please anyone can assist to solve this issue using PHP, would be appreciated.

var xyz="abcxyz";

$(document).load(function(){ console.log(HI); });

addInviewFunction({
'0': function(){ console.log(0); },
'1': function(){ console.log(1); },
'2': function(){ console.log(2); }});

addOutviewFunction({
'0': function(){ console.log('0'); },
'1': function(){ console.log('1'); },
'2': function(){ console.log('2'); }});

/*SOME JQUERY CODE HERE*/