2

Im trying to do this

$input = "<img src="HTML/images/user.png" alt="" />";

but it does not work out, i know im supposed to put a / before a " or something please help

4 Answers 4

4

Try this

$input = "<img src='HTML/images/user.png' alt='' />";

Or

$input = "<img src=\"HTML/images/user.png\" alt=\"\" />";
Sign up to request clarification or add additional context in comments.

3 Comments

I'd switch the quotes for XHTML compatibility
or escape the quotes in src and alt
or $input = '<img src="HTML/images/user.png" alt="" />'; ' is fast over the "
1

all you need to do is escape double quote. just like below.
\"HTML/images/user.png\" alt=\"\"

Comments

0

Note that you have use " for PHP already.

You can either choose to use ' or \".

For example,

$input = "<img src='HTML/images/user.png' alt='' />";

$input = "<img src=\"HTML/images/user.png\" alt=\"\" />";

Comments

0

Try this

$input = "<img src='HTML/images/user.png' alt='' />";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.