Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // encoding
- // PHP 5.3
- preg_replace_callback(
- '/\\\\u([0-9a-zA-Z]{4})/'
- , function ($matches) {
- return mb_convert_encoding(pack('H*',$matches[1]),'UTF-8','UTF-16');
- }
- , json_encode($array)
- );
- // PHP 5.4
- json_encode($arr,JSON_UNESCAPED_UNICODE);
- // decoding ※UTF-8限定
- $object = json_decode($str); // オブジェクト
- $array = json_decode($str, true); // 連想配列
Add Comment
Please, Sign In to add comment