Something
public text v1 · immutable$w = new SimpleXMLElement($widget['xml']);
// Change any <source> tag URL that may have changed
$elements = $w->xpath('//source');
foreach ($elements as $key => $element) {
if (!empty($element) && isset($url_changes[(string)$element])) {
$elements[$key] = $url_changes[(string)$element];
}
}
// Why does $w->asXML() not reflect that $elements[$key] change?