|
Last updated: 07/03/2009
This php
function replaces any occurances of tags in a string with the corresponding hash value in the $_REQUEST hash.
For example, if the string contains , it would be replaced with $_REQUEST["NAME"]. This is good for creating SQL calls, or building output strings.
function substitute ($s) {
$new_s = preg_replace('/{([a-z_A-Z]+)}/',"".$_REQUEST['$1']."",$s); eval('$new_s = "$new_s";'); return($new_s);
}
}
Note - You should change the regular expression to match what you are looking for; you can pass in an arbitrary array with values to substitute.
|