
<?php
string replace(string in, string token, string replaceWith)
{
return in.Replace(token, replaceWith);
}
?>
<?php
string myString = "I'm bad men.";
myString = replace(myString, " bad", "");
?>
But when working with games, doing it like I showed is much better practice.