Created
October 10, 2019 13:03
-
-
Save M4R14/73e3373ef12cf8ec63da302ec32d3b83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/php | |
| <?php | |
| $olddom = new DOMDocument('1.0', 'utf-8'); | |
| $olddom->loadHTMLFile('arc.html'); | |
| $boby = $olddom->getElementsByTagName('body')->item(0); | |
| $boby->insertBefore( | |
| $olddom->createElement('h1', 'Zippy'), | |
| $olddom->getElementsByTagName('p')->item(0) | |
| ); | |
| foreach ($boby->childNodes as $key => $value) { | |
| $boby->insertBefore( | |
| $olddom->createElement('h1', 'Zippy'), | |
| $value | |
| ); | |
| } | |
| echo $olddom->saveHTML(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment