
Stefan R. answered 02/28/20
Tutor
5.0
(625)
Senior PHP developer with 10+ years of experience
It depends on what you want to achieve, but there is a solution that always works:
$yourString = "let's find some time!!
See you soon";
$convertedToArray = ['yourString' => $yourString];
echo "let fromPHP = " . json_encode($confertedToArray) . ";";
In JavaScript, you can then use
fromPHP.yourString