cvs: pear /HTML_Table Table.php
| From: | Helgi �ormar �orbj�rnsson | Date: | Wed, 06 Apr 2005 20:09:18 +0000 |
| Subject: | cvs: pear /HTML_Table Table.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-30992@lists.php.net to get a copy of this message | ||
dufuz Wed Apr 6 16:09:18 2005 EDT
Modified files:
/pear/HTML_Table Table.php
Log:
Tiny speed up in 2x for loops
http://cvs.php.net/diff.php/pear/HTML_Table/Table.php?r1=1.22&r2=1.23&ty=u
Index: pear/HTML_Table/Table.php
diff -u pear/HTML_Table/Table.php:1.22 pear/HTML_Table/Table.php:1.23
--- pear/HTML_Table/Table.php:1.22 Sat Feb 26 15:39:02 2005
+++ pear/HTML_Table/Table.php Wed Apr 6 16:09:16 2005
@@ -17,7 +17,7 @@
// | Bertrand Mansion <bmansion@mamasam.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Table.php,v 1.22 2005/02/26 20:39:02 dufuz Exp $
+// $Id: Table.php,v 1.23 2005/04/06 20:09:16 dufuz Exp $
require_once 'PEAR.php';
require_once 'HTML/Common.php';
@@ -363,9 +363,11 @@
if (isset($contents) && !is_array($contents)) {
return PEAR::raiseError('First parameter to HTML_Table::addRow must be an
array');
}
+
$type = strtolower($type);
$row = $this->_rows++;
- for ($counter = 0; $counter < count($contents); $counter++) {
+ $contentCount = count($contents);
+ for ($counter = 0; $counter < $contentCount; $counter++) {
if ($type == 'td') {
$this->setCellContents($row, $counter, $contents[$counter]);
} elseif ($type == 'th') {
@@ -486,7 +488,8 @@
}
$type = strtolower($type);
$col = $this->_cols++;
- for ($counter = 0; $counter < count($contents); $counter++) {
+ $contentCount = count($contents);
+ for ($counter = 0; $counter < $contentCount; $counter++) {
$this->setCellContents($counter, $col, $contents[$counter], $type);
}
$this->setColAttributes($col, $attributes);