I'm fairly new to php. I have a very long string, and I don't want to have newlines in it. In python, I would accomplish this by doing the following:
new_string = ("string extending to edge of screen......................................."
+ "string extending to edge of screen..............................................."
+ "string extending to edge of screen..............................................."
)
Is there anything like this that I can do in PHP?
EOD = End Of Data, EOT = End of Text.
If you want to render the \' sequence, you must use three backslashes ( \\\' ). First \\ to render the backslash itself, and then \' to render the apostrophe.
We can create a string in PHP by enclosing the text in a single-quote. It is the easiest way to specify string in PHP. For specifying a literal single quote, escape it with a backslash (\) and to specify a literal backslash (\) use double backslash (\\).
You can use this format:
$string="some text...some text...some text...some text..."
."some text...some text...some text...some text...some text...";
Where you simply use the concat .
operator across many lines - PHP doesn't mind new lines - as long as each statement ends with a ;
.
Or
$string="some text...some text...some text...some text...";
$string.="some text...some text...some text...some text...";
Where each statement is ended with a ;
but this time we use a .=
operator which is the same as typing:
$string="some text...some text...some text...some text...";
$string=$string."some text...some text...some text...some text...";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With