-2

In php I have a problem, in some string I need to remove from <! to first >

<?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>

recommend which is better to use, maybe some standard function or maybe some custom suggestion. Thank you for your help.

shuba.ivan
  • 3,824
  • 8
  • 49
  • 121

1 Answers1

0

I would say something along the lines of

$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;

tmkiernan
  • 375
  • 1
  • 16