$bday = $f['date_of_birth']; //it outputs-> 20102016
So I tried using preg_split() or even explode() but was of no help
$str = $bday;
$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
print_r($chars[0]);
I want to use $bday as a nodeValue in DOMDocument to create XML file
$doc = new DOMDocument();
$doc->formatOutput = true;
$root = $doc->createElement('StudentDetails');
$root = $doc->appendChild($root);
$ele1 = $doc->createElement('DateOfBirth');
$ele1->nodeValue=$bday;
$root->appendChild($ele1);
I want my XML output to be like
<?xml version="1.0"?>
<StudentDetails>
<DateOfBirth>20/10/2016</DateOfBirth>
</StudentDetails>