I want to replace third table in php dom object with a new table. I can select it by
$table = $dom->getElementsByTagName('table')->item(3);
I tried
$table->parentNode->appendChild($new_table);
and it says
Catchable fatal error: Argument 1 passed to DOMNode::appendChild() must be an instance of DOMNode, string given in C:\xampp\htdocs\index.php on line 73
Can someone please explain what is wrong with the code or how I can correct it?
$new_table = "<table width='100%' bgcolor='#000'>$table_rows</table>";