I have some contents from a text file. I want to load it into a variable in PHP
I just need to copy/paste the text directly into a variable without escaping all quotes etc
How to do something like this? I'm not looking for a solution with
$str = "saldflasdfl
asdklksadlasd "quoted string"
How about this, which allows you to use unescaped quote marks in your text block:
$str = <<<DATA saldflasdfl asdklksadlasd "quoted string" aslkdlsadfkl DATA;
Note that it does need to be added with no whitespace indentation, since that would be taken to be part of the string.
However, do note that if your text block gets over a certain size, it is probably cleaner to put it in a text file and read it into a string.