Minor performance tweaks when working with alternating blocks in a string

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@68309 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker
2011-02-10 12:39:34 +00:00
parent 8218d04b0f
commit 0fd77aa397
5 changed files with 21 additions and 15 deletions
+4 -3
View File
@@ -348,9 +348,10 @@ class PHPExcel_ReferenceHelper
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
// Update cell references in the formula
$formulaBlocks = explode('"',$pFormula);
foreach($formulaBlocks as $i => &$formulaBlock) {
// Ignore blocks that were enclosed in quotes (even entries in the $formulaBlocks array after the explode)
if (($i % 2) == 0) {
$i = false;
foreach($formulaBlocks as &$formulaBlock) {
// Ignore blocks that were enclosed in quotes (alternating entries in the $formulaBlocks array after the explode)
if ($i = !$i) {
$adjustCount = 0;
$newCellTokens = $cellTokens = array();
// Search for row ranges (e.g. 'Sheet1'!3:5 or 3:5) with or without $ absolutes (e.g. $3:5)