3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST['contentDetails'] = '<p>This is data sample.&nbsp;</p><p>Second part of the paragraph.&nbsp;</p>'; $xml = '<?xml version="1.0" encoding="UTF-8">'; $xml .= '<root>'; $xml .= '<myData>'; $xml .= '<content>' . htmlentities(str_replace("&nbsp;", "", $_POST['contentDetails'])) . '</content>'; $xml .= '</myData>'; $xml .= '</root>'; echo $xml;

preferences:
127.54 ms | 405 KiB | 5 Q