You can do this a couple of ways in php.
$data = s/.word//s;
Would be:
$data = preg_replace("/\.*word/","",$data);
or
$data = eregi_replace(".*word","",$data);
$data = s/word.//s;
Would be:
$data = preg_replace("/word\.*/","",$data);
or
$data = eregi_replace("word.*","",$data);
Or something similar to this if you check the php site for preg_replace and ereg_replace they should have more information.