Using str_replace() and PHP_EOL:
$str = 'red
blue
green';
$str = str_replace(PHP_EOL, '<br><br>', $str);
echo $str;
EDIT: Using regex:
$str = 'red
blue
green
blue';
$str = preg_replace(array('/(\r?\n)+/', '/\r?\n/'),array(PHP_EOL,'<br><br>'), $str);
echo $str;