asmith Posted August 2, 2008 Share Posted August 2, 2008 Hey guys $a = array("A","ل","AA","صن"); foreach ($a as $show) { echo " $show => ".strlen($show)."<br />"; } the output is : A => 1 ل => 2 ََAA => 2 صن => 4 why utf-8 (persian) , characters are counted twice ?? how can i fix it? Link to comment https://forums.phpfreaks.com/topic/117847-strlen-shows-double-for-utf-characters/ Share on other sites More sharing options...
Stooney Posted August 2, 2008 Share Posted August 2, 2008 You are trying to count multi-byte characters. Use mb_strlen() http://us.php.net/manual/en/function.mb-strlen.php Link to comment https://forums.phpfreaks.com/topic/117847-strlen-shows-double-for-utf-characters/#findComment-606259 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.