I have an array of strings that contain html <object>'s like so:
$str = '<object width="600" height="338">
<param name="movie" value="http://www.youtube.com/v/YQSFQUkVUos?version=3&feature=oembed"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/YQSFQUkVUos?version=3&feature=oembed" type="application/x-shockwave-flash" width="600" height="338" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>';
Going through a loop of them, each inside a , I am echoing them out.
The problem is that instead of echoing the DOM elements, the string is being printed like so:
<div>
"<object width="600" height="338">
<param name="movie" value="http://www.youtube.com/v/YQSFQUkVUos?version=3&feature=oembed"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/YQSFQUkVUos?version=3&feature=oembed" type="application/x-shockwave-flash" width="600" height="338" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>"
</div>
The quotation marks are used as if I am printing an array, but I have checked that the type of the var is string.
What is going on here?
EDIT:
My string is actually pulled from an API, where I parse some info and use the follow array:
Array
(
[content] => <object width="600" height="338"><param name="movie" value="http://www.youtube.com/v/YQSFQUkVUos?version=3&feature=oembed"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/YQSFQUkVUos?version=3&feature=oembed" type="application/x-shockwave-flash" width="600" height="338" allowscriptaccess="always" allowfullscreen="true"></embed></object>
[width] => 600
[scrolling] =>
[height] => 338
)
I pick up [content] and am trying to output the <object> itself.
htmlspecialchars()orhtmlentities().$str = '"<!-- content -->"', and you need to remove the surrounding double quotes.