#18826 [NEW]: slow string search (strpos,ereg etc.)
| From: | potsataja at future dot ee | Date: | Fri, 09 Aug 2002 08:05:40 +0000 |
| Subject: | #18826 [NEW]: slow string search (strpos,ereg etc.) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-16364@lists.php.net to get a copy of this message | ||
From: potsataja@future.ee
Operating system: linux, redhat 7.2
PHP version: 4.2.2
PHP Bug Type: Strings related
Bug description: slow string search (strpos,ereg etc.)
Hi, i just upgraded php in my server to 4.2.2 and then problem began. I use
my own html parser (function at the bottom), what parses with new version
php very slow. I also found problem, it seems that ANY string-search
function is slower then in a older version.
------------------------------------------------
function ParseData($f,$v) {
if(defined("SID")) {
$v["SID"] = SID;
}
$n = 0;
while($s = strpos($f, "{", $n)) {
$e = strpos($f, "}", $s);
if(!is_int($e)) {
break;
}
$d = substr($f, $s+1, ($e - $s - 1));
if(!preg_match("/[[:space:]]+/", $d)) {
$f = str_replace("{".$d."}", $v[$d], $f);
}
$n++;
}
return $f;
}
---------------------------------------
i also tryd strpos function, what should be faster then regexp search but
it doesn't.
Taaniel
--
Edit bug report at http://bugs.php.net/?id=18826&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18826&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18826&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18826&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18826&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18826&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18826&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18826&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18826&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18826&r=globals