What is the recommended method in PHP to create a batch file with multiple commands on separate lines?

When creating a batch file with multiple commands on separate lines in PHP, it is recommended to use the PHP_EOL constant to represent the end of a line. This ensures that the batch file will be properly formatted regardless of the operating system being used.

$batchCommands = "command1" . PHP_EOL;
$batchCommands .= "command2" . PHP_EOL;
$batchCommands .= "command3" . PHP_EOL;

file_put_contents('batchfile.bat', $batchCommands);