Escape Dollar Sign

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Toot4fun
Forum Commoner
Posts: 25
Joined: Wed Dec 10, 2003 11:44 am

Escape Dollar Sign

Post by Toot4fun »

This is probably a very stupid question, but I can't seem to find an answer. How do I escape a $ within a string?

Example: "Hello$There"

This is correctly being interpreted as the string "Hello" followed by the variable $There. However, I'd like to escape the $ so that I can see if a user has entered any non-alphanumeric characters into a text box - in this case, the $. How is this done?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

\$

or 'Hello$There'
Toot4fun
Forum Commoner
Posts: 25
Joined: Wed Dec 10, 2003 11:44 am

Post by Toot4fun »

Ahhhh. I tried the \$, but not the single quotes. Works like a charm.

Thanks a lot!
Post Reply