Answers for "php convert string to xml"

PHP
0

php parse xml

$movies = new SimpleXMLElement($xmlstr);

echo $movies->movie[0]->plot;
Posted by: Guest on January-06-2021
0

php object to xml

<?php
$array = array('hello' => 'world', 'good' => 'morning');

$xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><foo />");
foreach ($array as $k=>$v) {
  $xml->addChild($k, $v);
}
?>
Posted by: Guest on July-04-2021
1

php xml string

htmlspecialchars($string, ENT_XML1 | ENT_QUOTES, 'UTF-8');// will convert ' to &apos; in addition to &, <, > and "( not | )
Posted by: Guest on June-04-2021

Browse Popular Code Answers by Language