Skip to content

Commit

Permalink
* Optimize memory usage in preg mode
Browse files Browse the repository at this point in the history
  • Loading branch information
anatoly techtonik committed Mar 11, 2005
1 parent 3a30b40 commit 07ab4e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SearchReplace.php
Expand Up @@ -368,7 +368,7 @@ function pregSearch($filename)
clearstatcache();

$file = fread($fp = fopen($filename, 'r'), filesize($filename)); fclose($fp);
$occurences = count($matches = preg_split($this->find, $file)) - 1;
$occurences = preg_match_all($this->find, $file, $matches);
$file = preg_replace($this->find, $this->replace, $file);

if ($occurences > 0) $return = array($occurences, $file); else $return = FALSE;
Expand Down

0 comments on commit 07ab4e0

Please sign in to comment.