How do I remove multiple blank lines from a string. I have looked at the examples on stackoverflow and have tried to change my code accordingly but I am not getting the right answer.
function removeMultipleBlankLines(&$array)
{
$value = $array;
$value = preg_replace("/(^[
]*|[
]+)[\s\t]*[
]+/", "
", $value);
return $value;
}
$textarray=array("The red","big"," "," ","fox","is ready","","","to jump.");
echo print_r(removeMultipleBlankLines($textarray));