Jump to content

Archived

This topic is now archived and is closed to further replies.

yahn

php string with brackets and semicolons in it. really.

Recommended Posts

I'm using ajax and I want to send a javascript function as text so I don't have to load every function I need in the aplication from the start.  But I don't know how to actually put brackets and semicolons in a string.  So if I wanted turn a simple [code=php:0]function foo() { alert('bar'); }[/code] into a string so I could send it as text how would I do that?  Thank you for your time.

Share this post


Link to post
Share on other sites
If you need to escape the characters put a \ in front of them :)

so

[code]
<?php

echo "This is \"MyText\" and this is how I want it to look.";
?>
[/code]

Comes out like:

This is "My Text" and this is how I want it to look.

Share this post


Link to post
Share on other sites
Ahh.  It's been too long since I've been working with mysql.  Thank you.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.