Using a foreach loop avoids Notice warnings when the array doesn't have sequential indexes, ex: 0, 1, 3...

This commit is contained in:
Ricardo Soares de Lima 2012-12-08 17:23:10 -02:00 committed by Christian Weiske
parent c4ba9ef2d2
commit 72269aa1d6
2 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
$tags_count = is_array($tags)?count($tags):0; $tags_count = is_array($tags)?count($tags):0;
for ($i = 0; $i < $tags_count; $i++) { foreach($tags as $i => $tag) {
$tags[$i] = trim(utf8_strtolower($tags[$i])); $tags[$i] = trim(utf8_strtolower($tags[$i]));
if ($fromApi) { if ($fromApi) {
include_once 'SemanticScuttle/functions.php'; include_once 'SemanticScuttle/functions.php';

View File

@ -144,7 +144,7 @@ class SemanticScuttle_Service_Tag extends SemanticScuttle_DbService
$tags = utf8_strtolower(trim($tags)); $tags = utf8_strtolower(trim($tags));
} else { } else {
$tags = array_filter($tags);//remove empty values $tags = array_filter($tags);//remove empty values
for($i=0; $i<count($tags); $i++) { foreach($tags as $i => $tag) {
$tags[$i] = utf8_strtolower(trim($tags[$i])); $tags[$i] = utf8_strtolower(trim($tags[$i]));
} }
} }