- preg_replace: documentation ( source)
<?php
$input=' Learn More
Hide [x]
Colors
Fetching Colors description...
Show more topics
Art exhibitions
Fetching Art exhibitions description...
Abstract art
Fetching Abstract art description...
Representational art
Fetching Representational art description...';
$output = preg_replace('/\s+/', ' ', $input);
echo $output;
?>