Easy way to apply a function to an array

前端 未结 7 811
無奈伤痛
無奈伤痛 2020-12-03 14:31

I am aware of array_walk() and array_map(). However when using the former like so (on an old project) it failed

array_walk($_POST,          


        
7条回答
  •  青春惊慌失措
    2020-12-03 14:41

    I had trouble using the accepted answer as it caused me errors for reasons I couldn't work out. So for anyone having trouble with array_walk or array_map I found this to work.

    foreach($_POST as $pk => $pv) $_POST[$pk] = mysql_real_escape_string($pv);
    

提交回复
热议问题