diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 5f57234d4bbfca999acc02eb976ea5dd2464bf93..e9ec126e328953b31d7ab87d542a04b15438b10c 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -640,7 +640,8 @@ function dolObfuscateEmail($mail, $replace="*", $nbreplace=8, $nbdisplaymail=4,
 	$mail_domaine = $tab2[0];
 	$mail_tld = '';
 
-	for($i=1; $i < count($tab2) && $displaytld ;$i++)
+	$nbofelem = count($tab2);
+	for($i=1; $i < $nbofelem && $displaytld; $i++)
 	{
 		$mail_tld .= '.'.$tab2[$i];
 	}
diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php
index 24a7cd86e4746f2611a7ab3d0df5735f51d5a4ca..0eff5075594098062ddf4a5d36ac06a1bd3d769a 100644
--- a/htdocs/core/lib/functionsnumtoword.lib.php
+++ b/htdocs/core/lib/functionsnumtoword.lib.php
@@ -37,7 +37,9 @@ function dolNumberToWord($numero, $langs, $numorcurrency='number')
 		return -1;
 	// Get 2 decimals to cents, another functions round or truncate
 	$strnumber = number_format ($numero,10);
-	for ($i=0; $i<strlen($strnumber); $i++){
+	$len=strlen($strnumber);
+	for ($i=0; $i<$len; $i++)
+	{
 		if ($strnumber[$i]=='.') {
 			$parte_decimal = $strnumber[$i+1].$strnumber[$i+2];
 			break;