note 45407 modified in function.strlen by thiago

From: Date: Wed, 11 Feb 2009 14:16:29 +0000
Subject: note 45407 modified in function.strlen by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-150485@lists.php.net to get a copy of this message
The easiest way to determine the character count of a UTF8 string is to pass the text through utf8_decode() first: <?php $length = strlen(utf8_decode($s)); ?> utf8_decode() converts characters that are not in ISO-8859-1 to '?', which, for the purpose of counting, is quite alright. --was-- The easiest way to determine the character count of a UTF8 string is to pass the text through utf8_decode() first: $length = strlen(utf8_decode($s)); utf8_decode() converts characters that are not in ISO-8859-1 to '?', which, for the purpose of counting, is quite alright. http://php.net/manual/en/function.strlen.php

« previous php.notes (#150485) next »