I have a function textag($express ion){...}
whose $expression argument is a string that
can contain substrings like \alpha with one
backslash or like a&b\\c&d with two backslashes.
If I write <?php textag('\alpha' ); ?with the
expression argument in single quotes, then that
works fine, and the single backslash isn't
interpreted or changed, which is what I want.
But if I write <?php textag('a&b\\c& d'); ?>
then the double \\ gets translated to a single \,
which isn't what I want. Now, I can write
<?php textag('a&b\\\\ c&d'); ?to get a&b\\c&d,
but that's quit inconvenient and kludgey.
Is there some way to fix this that's transparent
to the user calling textag()? I can't really
do any kind of preg_replace, because that would
also change the originally correct \alpha to
incorrect \\alpha. Thanks for any suggestions,
--
John Forkosh ( mailto: j@f.com where j=john and f=forkosh )
whose $expression argument is a string that
can contain substrings like \alpha with one
backslash or like a&b\\c&d with two backslashes.
If I write <?php textag('\alpha' ); ?with the
expression argument in single quotes, then that
works fine, and the single backslash isn't
interpreted or changed, which is what I want.
But if I write <?php textag('a&b\\c& d'); ?>
then the double \\ gets translated to a single \,
which isn't what I want. Now, I can write
<?php textag('a&b\\\\ c&d'); ?to get a&b\\c&d,
but that's quit inconvenient and kludgey.
Is there some way to fix this that's transparent
to the user calling textag()? I can't really
do any kind of preg_replace, because that would
also change the originally correct \alpha to
incorrect \\alpha. Thanks for any suggestions,
--
John Forkosh ( mailto: j@f.com where j=john and f=forkosh )
Comment