在 PHP 字符串中如何将文本替换为空 space 从符号到符号

In PHP string how to replace text to empty space from symbol to symbol

在 php 我有一个问题,在一些字符串中我需要从 <! 删除到第一个 >

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
<cXML xml:lang="en-US"
 payloadID="0c30050@supplierorg.com"
 timestamp="2000-01-08T23:00:06-08:00">
    <Header>

推荐哪个更好用,可能是一些标准功能,也可能是一些自定义建议。 感谢您的帮助。

我想说的是

$string = "hello there 
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd">
nice to meet you
and others text";

$string = preg_replace( "/<!.*?>/", "", $string );

echo $string;