There is no built-in way to do this. bigwebguy created a function for in one of its answers :
public static function interpolateQuery($query, $params) {
$keys = array();
foreach ($params as $key => $value) {
if (is_string($key)) {
$keys[] = '/:'.$key.'/';
} else {
$keys[] = '/[?]/';
}
}
$query = preg_replace($keys, $params, $query, 1, $count);
return $query;
}
source
share