You want to use regular expressions. The
matches a word boundary.
$text = preg_replace('/Hello/', 'NEW', $text);
If $text
contains UTF-8 text, you'll have to add the Unicode modifier "u", so that non-latin characters are not misinterpreted as word boundaries:
$text = preg_replace('/Hello/u', 'NEW', $text);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…