No reason to use a library to achieve this. Use preg replace to match \r
or \n
or both and replace it with nothing.
preg_replace( "/\r|\n/", "", $ACE);
As far as removing indentation is concerned, that's just white space, which can be removed with php's function trim
$trimmed = trim($ACE);
Further, trim accepts a 2nd argument which you can pass in and have trimmed as well:
$trimmed = trim($ACE, '\t.');
Which for instance will trim the tab character.