simple easy way to remove breaks would be to search for them and remove them:
if the string has HTML:
$myString = “ there is no breaks “;
$myString = str_replace(“”, “”, $myString);
echo $myString;
// output: there is no breaks
if the string is text search for newline
$myString = “there is n no breaks”;
$myString = str_replace(” n”, “”, $myString);
echo $myString;
// output: there is no breaks
You could use preg_replace() and use a single regular expression to search for all line breaks regardless of HTML or plain text, do a google search for regular expression and you will figure that out,
good luck
Remove line breaks from a string.
$theString = “Hello Aaron. How are you?”;
$removeBreaks=str_replace(“ “, “”, $theString);
Add line breaks to a string.
$theString = “I have never climbed Mt.Everest”;
$addBreaks=str_replace(“climbed”, “climbed “, $theString);
simple easy way to remove breaks would be to search for them and remove them:
if the string has HTML:
$myString = “ there is no breaks “;
$myString = str_replace(“”, “”, $myString);
echo $myString;
// output: there is no breaks
if the string is text search for newline
$myString = “there is n no breaks”;
$myString = str_replace(” n”, “”, $myString);
echo $myString;
// output: there is no breaks
You could use preg_replace() and use a single regular expression to search for all line breaks regardless of HTML or plain text, do a google search for regular expression and you will figure that out,
good luck
Remove line breaks from a string.
$theString = “Hello Aaron.
How are you?”;
$removeBreaks=str_replace(“
“, “”, $theString);
Add line breaks to a string.
$theString = “I have never climbed Mt.Everest”;
$addBreaks=str_replace(“climbed”, “climbed
“, $theString);