Hey Guys,
I'm trying to find a way to get to <key k_id="4"> using php. I've been trying to get this working all day yesterday and today. Can you guys see what I'm doing wrong?
This is my xml file
The php code I'm using that's not working.
I'm trying to find a way to get to <key k_id="4"> using php. I've been trying to get this working all day yesterday and today. Can you guys see what I'm doing wrong?
This is my xml file
Code:
<?xml version="1.0" encoding="utf-8"?>
<keys>
<key k_id="1">
<k_id>1</k_id>
<k_key>_Monkey</k_key>
</key>
<key k_id="2">
<k_id>2</k_id>
<k_key>_Test</k_key>
</key>
<key k_id="3">
<k_id>3</k_id>
<k_key>_Hello</k_key>
</key>
<key k_id="4">
<k_id>4</k_id>
<k_key>_GoodBye</k_key>
</key>
</keys>
The php code I'm using that's not working.
Code:
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->load("{$this->paths->avs_web}xml/keys.xml");
foreach ($doc->childNodes as $node) {
$lastelement = $this->get_lastchild($node->lastChild);
$lastid = (int)$lastelement->getAttribute("k_id");
$newid = $lastid + 1;
}






