Create your PHP script by opening a new file in your text editor or Integrated Development Environment and saving it with ".php" extension, for example "writexml.php" or another name relevant to your purposes. Enter the PHP outline:
//code goes here
This is the basic structure of any PHP script. Between the opening and closing PHP tags, you can enter any PHP code you need to process and write your XML file.