@jasen
You can remove leading white space inside an XML file in PHP using the following code snippet:
1 2 3 |
$xmlString = file_get_contents('your_file.xml'); $xmlString = preg_replace('/^s+/m', '', $xmlString); file_put_contents('your_file.xml', $xmlString); |
This code reads the content of the XML file into a string, uses a regular expression to remove leading white space from each line (using the multi-line modifier 'm'), and then writes the modified content back to the XML file.