- var_dump: documentation ( source)
- json_decode: documentation ( source)
- strip_tags: documentation ( source)
- html_entity_decode: documentation ( source)
- json_encode: documentation ( source)
<?php
$data = "<p>This is some <b>data</b>
It has some <i>new lines</i> in it & it has some <u>HTML</u> in it</p>
<div>Look, there's some more new lines</div>";
var_dump($data);
echo "\n\n";
$stripped = html_entity_decode(strip_tags($data));
var_dump($stripped);
echo "\n\n";
$json = json_encode($stripped);
var_dump($json);
echo "\n\n";
$decoded = json_decode($json);
var_dump($decoded);