From 1f188d3f9242092f471055facb5e25d968137cda Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Tue, 23 Nov 2010 22:43:43 +0000 Subject: [PATCH] Minor performance tweak git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@64214 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Cell.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index 9c76e6c0..796217be 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -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") . "."); } /**