Possible Duplicate:
In PHP (>= 5.0), is passing by reference faster?
I wonder if by declaring the parameter pass by reference, the PHP interpreter will be faster for not having to copy the string to the function's local scope? The script turns XML files into CSVs, which have thousands of records, so little time optimizations count.
Olur bu:
function escapeCSV( & $string )
{
$string = str_replace( '"', '""', $string ); // escape every " with ""
if( strpos( $string, ',' ) !== false )
$string = '"'.$string.'"'; // if a field has a comma, enclose it with dobule quotes
return $string;
}
Bu daha hızlı ol:
function escapeCSV( $string )
{
$string = str_replace( '"', '""', $string ); // escape every " with ""
if( strpos( $string, ',' ) !== false )
$string = '"'.$string.'"'; // if a field has a comma, enclose it with dobule quotes
return $string;
}
?