Hi,
if you have exactly one php-variable for each js-line, you could could get rid of the newlines like this ($commandline is the line as you already have it, $new_commandline contains what you want to have):
<?php
$dummy = explode("\n", $commandline);
$new_commandline = implode("", $dummy);
?>
There are possibly more elegant ways to do it with regexps, but I don't have a clou about this ;-)
Cheers, Markus