hello,

i want to make strings coming out of database into quotes...the e-mail addresses as they came out should
convert into quotes ..like

abc@abc.com into 'abc@abc.com'.

Recommended Answers

All 9 Replies

Use a backslash (eg. echo '\'abc@abc.com\'';)

Member Avatar for diafol

Or

echo "'$email'";

Or

echo '"{$email}"';

Or

echo '"' . $email . "';

Or

echo '"$email"';

Or even...

echo '"' . htmlspecialchars($email) . '"';

Just sayin'

Member Avatar for diafol

Just sayin'

Some of these won't work...

echo '"$email"'; //will output the literal "$email"
echo '"{$email}"'; //will output the literal "{$email}"

And this doesn't match the OP's needs - I'm assuming single quote from the first post:

echo '"' . $email . "'; //gives "example@example.com" - double quoted

@diafol — Oops! I forgot my PHP logic there. Remove the post and I'll leave it to you for this... since your one seems to be logical.

Member Avatar for diafol

@matrixdevuk

I'm afraid it's "post and be damned". We only remove posts in very rare circumstances - usually if they contravene our rules, but almost never at the behest of an user. Sorry. You have approx. 30 minutes to edit your post from first publication. I know that doesn't help you right now, but useful info for another time maybe.

Could you edit it so the OP doesn't get confused? Tell them to ignore it.

Member Avatar for diafol

I think it should be pretty clear from the explanations that follow. I can't see any imperative to edit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.