const str = 'php typescript php javascript php node.js';
const lastIndex = str.lastIndexOf("php");
const before = str.slice(0, lastIndex);
console.log(before);
const after = str.slice(lastIndex);
console.log(after);
/*
run:
"php typescript php javascript "
"php node.js"
*/