Guest User

Untitled

a guest
Apr 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // encoding
  2.  
  3. // PHP 5.3
  4. preg_replace_callback(
  5. '/\\\\u([0-9a-zA-Z]{4})/'
  6. , function ($matches) {
  7. return mb_convert_encoding(pack('H*',$matches[1]),'UTF-8','UTF-16');
  8. }
  9. , json_encode($array)
  10. );
  11.  
  12. // PHP 5.4
  13. json_encode($arr,JSON_UNESCAPED_UNICODE);
  14.  
  15. // decoding ※UTF-8限定
  16. $object = json_decode($str); // オブジェクト
  17. $array = json_decode($str, true); // 連想配列
Add Comment
Please, Sign In to add comment