PHP need to trim all the $_POST variables

前端 未结 8 1835
广开言路
广开言路 2021-01-01 23:14

Need you help in an unusal situation. I need to trim all the $_POST variables.

Is there any way I can do it at a single shot i.e., using a single function?

I

8条回答
  •  醉梦人生
    2021-01-01 23:59

    I think it's better to use anonymous functions :

    array_walk($_POST, function(& $value){
        $value = trim($value);
    });
    

提交回复
热议问题