1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 03:54:10 +01:00

Improved the performance of remove_remarks() by an order of magnitude.

git-svn-id: file:///svn/phpbb/trunk@1063 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
natec 2001-09-23 00:31:56 +00:00
parent fa76b50795
commit 2ea142d935

View File

@ -659,25 +659,27 @@ function output_table_content($content)
//
function remove_remarks($sql)
{
$i = 0;
$lines = explode("\n", $sql);
$linecount = count($lines);
$output = "";
while($i < strlen($sql))
for ($i = 0; $i < $linecount; $i++)
{
if( $sql[$i] == "#" && ( $sql[$i-1] == "\n" || $i==0 ) )
if (($i != ($linecount - 1)) || (strlen($lines[$i]) > 0))
{
$j = 1;
while( $sql[$i + $j] != "\n" )
if ($lines[$i][0] != "#")
{
$j++;
$output .= $lines[$i] . "\n";
}
else
{
$output .= "\n";
}
$sql = substr($sql,0,$i) . substr($sql,$i+$j);
}
$i++;
}
return($sql);
return $output;
}
//