How do you remove Apostropies and Double Quotes?

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

User avatar
hypedupdawg
Forum Commoner
Posts: 74
Joined: Sat Apr 10, 2010 5:21 am

Re: How do you remove Apostropies and Double Quotes?

Post by hypedupdawg »

Interesting; I did some more research and stumbled across this fact - the echoing a variable inside a string, e.g.

Code: Select all

echo "My name is $name"
Only works if the string is in double quotes. I never knew this before :banghead: and am quite annoyed! Anyway, that is the reason your previous enquiry...
echo '<td valign="top"><a href="index.php?page=emailid&id=' . $row->id . '&head=email detail" style="text-decoration: none;" title="' . htmlspecialchars($row->communication, ENT_QUOTES, "UTF-8") . '">' . $row->reason . '</a></td>';
...didn't work - it used single quotes. However, it does present a problem; either you can:

- Use double quotes, then go through and escape all the other double quotes in the string
or
- You have to use single quotes and the concatenation dots.

Arrrgh!
Post Reply