I know howto escape quotes etc in php for Javascript however is there a function that can do this for me?
In perl I would use regex
$myvar =~ s/\'/\'/g; # escape ' as required by javascript
$myvar=~ s/[\n\r]//g; # remove line feeds
Is there a php function that does similar?