Move strtolower() call from PR #3739 out of the loop
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index a77ed57..5005d01 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -918,6 +918,8 @@
 		}
 
 		is_bool($escape) OR $escape = $this->_protect_identifiers;
+		// lowercase $side in case somebody writes e.g. 'BEFORE' instead of 'before' (doh)
+		$side = strtolower($side);
 
 		foreach ($field as $k => $v)
 		{
@@ -925,9 +927,6 @@
 				? $this->_group_get_type('') : $this->_group_get_type($type);
 
 			$v = $this->escape_like_str($v);
-			
-			// lowercase $side for in case of UPPERCASE string
-			$side = strtolower($side);
 
 			if ($side === 'none')
 			{