How can the
element be deleted inside this XML string?
$input=
\'dfd jdh flkdjf
My Test Title
Simplexml
$str = '<items>1<title>lalala</title><others>...</others></items>';
$xml = simplexml_load_string($str);
unset($xml->children()->title);
$output = str_replace("<?xml version=\"1.0\"?>\n", '', $xml->asXml());
If you are working with unknown input data, or with production code, you should use an XML parser.
If you're working in test environment and the input data is known:
$output = preg_replace('%<title>[^<]*</title>%', '', $input);
If you need to allow for attributes on the tag, I suggest using a real XML parser, for maximum reliability and minimum chance of error.