- date_create: documentation ( source)
- date_default_timezone_set: documentation ( source)
- date_format: documentation ( source)
<?php
// Start constructing FuncAck XML
// Set timezone to surpass related errors.
date_default_timezone_set('America/New_York');
//c Create Timestamp
$date = date_create();
$timestamp = date_format($date, 'Y-m-d\TH:i:s');
// Start constuction of XML with new SimPleXML Object.
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><InstantElectronicDelivery version="2009.1"/>');
// Add Timestamp
$xml->addChild('Timestamp', $timestamp);
// Add StatusCode
$xml->addChild('StatusCode', 'C01');
// Add StatusMessage
$xml->addChild('StatusMessage', 'Received');
// Add Items Parent Node
$ItemsNode = $xml->addChild('Items');
$ItemsNode->addChild('Item');
$ItemsNode->addChild('Item');
$dom = new DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
echo $dom->saveXML();