here is the variable :
$letexts = "Hello this is a sample
after 2 return breaks there is ...
another 3 return breaks";
As you can see there are 2 return breaks and then after that 3 return breaks.
I would like to be able to have this results:
echo $letexts;
will display:
Hello this is a sample
after 2 return breaks there is ...
another 3 return breaks
I used all of these and NONE worked so it got me pulling my hair:
$letexts = preg_replace("/\r\n\s*\r\n/", "\r\n", $letexts);
$letexts = str_replace(array("\r", "\n", "\r\n"), "\r\n", $letexts);
$letexts = trim($letexts);
$letexts = preg_replace('~[\r\n]~','',$letexts);
any suggestions please?
If you want to display in html.
Use the function nl2br.