You need to HTML escape data echoed into HTML:
printf('<article data-tags="%s">',
htmlspecialchars(json_encode(array('html5', ...)), ENT_QUOTES, 'UTF-8'));
More Related Contents:
- How can I parse JSON into a html table using PHP?
- Sending HTML Code Through JSON
- Why are escape characters being added to the value of the hidden input
- Scrollable PHP Table [closed]
- How and where to put Jquery into a fully PHP page?
- PHP Multidimensional associative array to HTML table
- How to add html menu in php [closed]
- Getting particular object
- php login don’t work
- How can I parse a JSON file with PHP? [duplicate]
- PHP Parse HTML code [duplicate]
- Cannot use object of type stdClass as array?
- Opening/closing tags & performance?
- How to remove line breaks (no characters!) from the string?
- Any way to return PHP `json_encode` with encode UTF-8 and not Unicode? [duplicate]
- Why is this PHP call to json_encode silently failing – inability to handle single quotes?
- Delete multiple rows by selecting checkboxes using PHP
- PHP HTML DOMDocument getElementById problems
- How to add a delete button to a PHP form that will delete a row from a MySQL table
- Send email with PHPMailer – embed image in body
- DOM parser that allows HTML5-style
- PHP’s json_encode does not escape all JSON control characters
- POST request with JSON body
- Web scraping in PHP
- PHP json_encode json_decode UTF-8
- PHP: How to encode infinity or NaN numbers to JSON?
- how to embed html files in php code?
- HTML form PHP post to self to validate or submit to new page
- displaying a message after redirecting the user to another web page [duplicate]
- Escape HTML to PHP or Use Echo? Which is better?