i have an array with around 10 key values. which is the best way to add mysql_real_escape_string to all of them 开发者_如何学编程?
$escaped_array=array_map('mysql_real_escape_string',$array);
Look at array_map
You can create short-cut method.. something like this ..
function mres($v){
return mysql_real_escape_string($v);
}
and you can use mres as a function.
精彩评论