Posted by gosha bine on 04/27/07 14:52
On 27.04.2007 16:35 ashore wrote:
> Say I'm using a snippet like
> $phpfoo = "a\nb\nc";
> var jsfoo = "<?php echo $phpfoo;?>";
>
> This errors out because JS sees the newline, and it needs to be
> escaped somehow. (In my real case, $phpfoo came from MySQL, and it's
> retrieved and displayed OK.)
>
> What do you folks use in this kind of situation? Thanks, all.
>
> AS
>
try
<?php echo addcslashes($phpfoo, "\0..\37");?>
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
[Back to original message]
|