- var_dump: documentation ( source)
- preg_replace_callback: documentation ( source)
- html_entity_decode: documentation ( source)
- json_encode: documentation ( source)
<?php
$json = array(
"Sample" => array(
"context" => 'جمهوری اسلامی ایران'
)
);
$encoded = json_encode($json);
var_dump($encoded);
$unescaped = preg_replace_callback('/\\\u(\w{4})/', function ($matches) {
return html_entity_decode('&#x' . $matches[1] . ';', ENT_COMPAT, 'UTF-8');
}, $encoded);
var_dump($unescaped);