3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function unicodeToHtmlEntities($string) { $result = ''; $length = mb_strlen($string); for ($i = 0; $i < $length; $i++) { $result .= '&#' . chr(mb_substr($string, $i, 1)) . ';'; } return $result; } function unicodeToHtmlEntities2($string) { $result = ''; $length = strlen($string); for ($i = 0; $i < $length; $i++) { $result .= '&#' . ord(substr($string, $i, 1)) . ';'; } return $result; } echo unicodeToHtmlEntities('йцук');
based on CpfaV
Output for 5.6.7 - 7.2.6
&#;&#;&#;&#;
Output for 4.3.0 - 5.5.35
&#;&#;&#;&#;&#;&#;&#;&#;