You can use
$q_string = substr($row['1'], 14);
to get the same results with some speed gain. I have tested speeds of three function so you can see how they compare with speed.
$string = 'javascript:l("Bayou-La-Batre")';
$str_replace = function($string) {
return str_replace('javascript:l("', '', $string);
};
print $str_replace($string) . "\n";
$substr = function($string) {
return substr($string, 14);
};
print $substr($string) . "\n";
$preg_replace = function($string) {
return preg_replace('/^[a-z:\(]+"/', '', $string);
};
print $preg_replace($string) . "\n";
function measure($function, $string) {
$start = microtime(true);
for($i = 0; $i < 1000000; $i++) {
$function($string);
}
return microtime(true) - $start;
}
print 'Substr: ' . measure($substr, $string) . "\n";
print 'Str replace:' . measure($str_replace, $string) . "\n";
print 'Preg replace:' . measure($preg_replace, $string);
The output of this on my machine
Bayou-La-Batre")
Bayou-La-Batre")
Bayou-La-Batre")
Substr: 3.7492098808289
Str replace:4.5258920192719
Preg replace:5.8815109729767