for ($i = 0; $i < 3; $i++){ if (trim(strtolower($this->foo[$i])) != trim(strtolower($this->foo[$i]))) { $diffArr[] = 'foo_'.$i; }}