Click here to get back home

better preg_replace

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
better preg_replace Matija Papec 07-10-2008
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
);
}


Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap