|
Posted by Matija Papec on July 10, 2008, 9:10 am
Please log in for more thread options
I'm having trouble with regular expression readability; is there a
better way to write preg_replace which would replace all occurrences of
:someWord with 'addslashes($arr["someWord"])'?
function DBReplacePlaceholders ($sql, &$arr) {
return preg_replace(
"/:(\w+)/e",
'"\'". addslashes($arr[""]) ."\'"',
$sql
);
}
|