Minor performance tweak

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@64214 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-11-23 22:43:43 +00:00
parent 9641c16df0
commit 1f188d3f92
1 changed files with 7 additions and 7 deletions

View File

@ -649,16 +649,16 @@ class PHPExcel_Cell
// We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString
// for improved performance
if (isset($pString[0])) {
if (!isset($pString[1])) {
if (isset($pString{0})) {
if (!isset($pString{1})) {
return $_columnLookup[$pString];
} elseif(!isset($pString[2])) {
return $_columnLookup[$pString[0]] * 26 + $_columnLookup[$pString[1]];
} elseif(!isset($pString[3])) {
return $_columnLookup[$pString[0]] * 676 + $_columnLookup[$pString[1]] * 26 + $_columnLookup[$pString[2]];
} elseif(!isset($pString{2})) {
return $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}];
} elseif(!isset($pString{3})) {
return $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}];
}
}
throw new Exception("Column string index can not be " . ((isset($pString[0])) ? "longer than 3 characters" : "empty") . ".");
throw new Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty") . ".");
}
/**