note 119565 added to json.constants
| From: | majid4466 at gmail dot com | Date: | Thu, 07 Jul 2016 17:57:23 +0000 |
| Subject: | note 119565 added to json.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205918@lists.php.net to get a copy of this message | ||
To get a really clean json string use these three constants like so:
<?php
$array = ['â¬', 'http://example.com/some/cool/page',
'337'];
$bad = json_encode($array);
$good = json_encode($array, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
// $bad would be ["\u20ac","http:\/\/example.com\/some\/cool\/page","337"]
// $good would be ["â¬","http://example.com/some/cool/page",337]
?>
----
Server IP: 72.52.91.14
Probable Submitter: 37.27.236.8
----
Manual Page -- http://php.net/manual/en/json.constants.php
Edit -- https://master.php.net/note/edit/119565
Del: integrated -- https://master.php.net/note/delete/119565/integrated
Del: useless -- https://master.php.net/note/delete/119565/useless
Del: bad code -- https://master.php.net/note/delete/119565/bad+code
Del: spam -- https://master.php.net/note/delete/119565/spam
Del: non-english -- https://master.php.net/note/delete/119565/non-english
Del: in docs -- https://master.php.net/note/delete/119565/in+docs
Del: other reasons-- https://master.php.net/note/delete/119565
Reject -- https://master.php.net/note/reject/119565
Search -- https://master.php.net/manage/user-notes.php