3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = '<p> Evaluation<!--[if gte mso 9]><xml> <o:OfficeDocumentSettings> <o:AllowPNG /> <o:TargetScreenSize>1024x768</o:TargetScreenSize> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> </w:Compatibility> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Normale Tabelle"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--></p>'; $dom = new DOMDocument; $dom->loadHtml($str); $xpath = new DOMXPath($dom); foreach ($xpath->query('//comment()') as $comment) { $comment->parentNode->removeChild($comment); } echo $dom->saveXML($str);
based on tFGZp
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode or null, string given in /in/2ds9u:58 Stack trace: #0 /in/2ds9u(58): DOMDocument->saveXML('<p>\n\tEvaluation...') #1 {main} thrown in /in/2ds9u on line 58
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode, string given in /in/2ds9u:58 Stack trace: #0 /in/2ds9u(58): DOMDocument->saveXML('<p>\n\tEvaluation...') #1 {main} thrown in /in/2ds9u on line 58
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Catchable fatal error: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode, string given in /in/2ds9u on line 58
Process exited with code 255.