PHP 8.5.0 Alpha 4 available for testing

Voting

: six plus zero?
(Example: nine)

The Note You're Voting On

p dot reisinger at gmail dot com
16 years ago
When you use function/method below, php automaticaly inserts namespaces (if you have some). If you want to join xml files exactly, then you can just use placeholders and treat xml as a string.
<?php
function joinXMLStrings($file1, $file2)
{
//remove xml declaration
$file2 = trim(preg_replace('/<\?xml.*\?>/', '', $file2, 1));

//insert file2 in the place of placeholder in the first file
$file1 = trim(preg_replace('/<\?file2\s\?>/', $file2, $file1, 1));
}
?>

so function looks like this and you insert two xml files. First file has to have placeholder (where you insert file2). Placeholder in this case will be <?file2 ?>

!!!this is only for ilustration - test before you use it

<< Back to user notes page

To Top