Browse Source

[svn r20677] FS#306 - The multibyte string library: Adding a comment about the function api_strlen().

Ivan Tcholakov 16 years ago
parent
commit
692d660103
1 changed files with 6 additions and 1 deletions
  1. 6 1
      main/inc/lib/multibyte_string_functions.lib.php

+ 6 - 1
main/inc/lib/multibyte_string_functions.lib.php

@@ -636,6 +636,11 @@ function api_stristr($haystack, $needle, $part = false, $encoding = null) {
  * This function is aimed at replacing the functions strlen() and mb_strlen() for human-language strings.
  * @link http://php.net/manual/en/function.strlen
  * @link http://php.net/manual/en/function.mb-strlen
+ * Note: When you use strlen() to test for an empty string, you needn't change it to api_strlen().
+ * For example, in lines like the following:
+ * if (strlen($string) > 0)
+ * if (strlen($string) != 0)
+ * there is no need the original function strlen() to be changed, it works correctly and faster for these cases.
  */
 function api_strlen($string, $encoding = null) {
 	if (empty($encoding)) {
@@ -1716,4 +1721,4 @@ if (!function_exists('mb_strstr')) {
 	}
 }
 
-?>
+?>