note 71250 deleted from function.json-encode by danbrown
| From: | danbrown@php.net | Date: | Sat, 18 Sep 2010 15:45:54 +0000 |
| Subject: | note 71250 deleted from function.json-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172715@lists.php.net to get a copy of this message | ||
Note Submitter: Andrea Giammarchi
----
// ... and this is performance/memory optimized version :)
function json_real_encode($obj){
$f = $r = array();
foreach(array_merge(range(0, 7), array(11), range(14, 31)) as $v) {
$f[] = chr($v);
$r[] = "\\u00".sprintf("%02x", $v);
}
return str_replace($f, $r, json_encode($obj));
}