freelance71 wrote:
>freelance71 schreef:
>>I have to pass the string '\abcd' to a function. Ofcourse one (or two)
extra '\' is needed to escape but experimenting with it shows that I have
to pass three extra backslashes to make it work.
[...]
can it be because I'm using it in a PHP file like this?
<?php
echo <<< HTMLOUT
<script>
var q = '\\\\abcd';
displayLatex(q);
</script>
HTMLOUT;
?>
Yes, you have to escape each backslash for use with `echo'. A simple test
(with php -a) shows that
<?php
echo <<<HTML
var q = '\\a';
HTML;
?>
displays only one backslash.
The simple and most efficient solution is to take heed of this general
advice: Do not let the PHP parser do things it does not have to.
<?php
...
?>
var q = '\\a';
<?php
...
?>
(The first and last part are optional, of course.)
F'up2 cl.php
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann