16
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPで数値文字参照

Last updated at Posted at 2014-10-15

「あ」が「あ」になるようなやつ。(&#は半角で)
mb_convert_encoding()でできるのを知った。

// 日本語文字列 -> 数値文字参照
$value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8');

// 数値文字参照 -> 日本語
$value = mb_convert_encoding($value, 'UTF-8', 'HTML-ENTITIES');
16
20
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?