fork(1) download
  1. <?php
  2.  
  3. $tag = '<string name="abs__action_bar_home_description">My old title</string>';
  4. $new_title = 'My new title';
  5. $dom = new DOMDocument('1.0', 'UTF-8');
  6. @$dom->loadHTML($tag, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
  7.  
  8. $xpath = new DOMXPath($dom);
  9. $links = $xpath->query('//string[@name="abs__action_bar_home_description"]');
  10.  
  11. foreach($links as $link) {
  12. $link->nodeValue = $new_title;
  13. }
  14.  
  15. echo $dom->saveHTML();
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
<string name="abs__action_bar_home_description">My new title</string>