/*
* simplexml_load_file converts the xml documents into an Object
*
*/
$source1 = simplexml_load_file("test1.xml");
/*
* json_encode Returns the JSON representation of a value
*/
$source1 = json_encode($source1);
$source2 = simplexml_load_file("test2.xml");
$source2= json_encode($source2);
/*
* json_decoded Decodes a JSON values
* Assigning the json_decoded values in an array Object
*/
$sourceArrayObject[] = json_decode($source1. true);
$sourceArrayObject[] = json_decode($source1, true);
/*
* Converting the JSON decoded array object back to the json format
*/
$testJsonFormat = json_encode($sourceArrayObject, JSON_PRETTY_PRINT);
/*
* Filepath to save the combined JSON values xml
*/
$filePath = __DIR__ . '/data/data.txt';
/*
* saving the JSON representation of a values in a file
*/
file_put_contents($filePath, $testJsonFormat);