Jump to content


Photo

php string with brackets and semicolons in it. really.


  • Please log in to reply
2 replies to this topic

#1 yahn

yahn
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 July 2006 - 07:31 PM

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
function foo() { alert('bar'); }
into a string so I could send it as text how would I do that?  Thank you for your time.

#2 SharkBait

SharkBait
  • Members
  • PipPipPip
  • Advanced Member
  • 845 posts
  • LocationMetro Vancouver, BC

Posted 04 July 2006 - 07:34 PM

If you need to escape the characters put a \ in front of them :)

so

<?php

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

Comes out like:

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



#3 yahn

yahn
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 July 2006 - 07:42 PM

Ahh.  It's been too long since I've been working with mysql.  Thank you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users