From 692d660103e753ba67f9fdfe2add70c498360f4f Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Fri, 15 May 2009 11:16:32 +0200 Subject: [PATCH] [svn r20677] FS#306 - The multibyte string library: Adding a comment about the function api_strlen(). --- main/inc/lib/multibyte_string_functions.lib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/inc/lib/multibyte_string_functions.lib.php b/main/inc/lib/multibyte_string_functions.lib.php index 07aaffff60..6719c868e1 100644 --- a/main/inc/lib/multibyte_string_functions.lib.php +++ b/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')) { } } -?> \ No newline at end of file +?>